Read the equation
ReLU returns x when positive and zero otherwise. Away from zero its derivative is one on the positive side and zero on the negative side. At the nondifferentiable origin the implementation chooses the conventional subgradient value zero.
Terms & definitions
| Term | Meaning in this source |
|---|---|
| x | Input |
| z | Rectified output |
How it works
Read the definition from its right-hand expression to the quantity on the left. Its surrounding source records the intended input, state, or parameter context. Where the source leaves an operation unspecified, this page preserves that gap.
Assumptions & limits
Source recovery establishes that the expression appears in this record. Its mathematical validity, implementation behavior, and interpretation must be assessed separately. See the linked source and research notes for the checks available for this version.
Original context
Read the surrounding source passage
z->inputs = {x};
z->backward_fn = [x, z, s]() {
x->grad += z->grad * s * (1.0 - s);
};
return tape.record(z);
}
// ReLU: z = max(0, x), dz/dx = (x > 0) ? 1 : 0
inline GradNodePtr relu(GradNodePtr x, TapeRecorder& tape) {
auto z = std::make_shared<GradNode>(std::max(0.0, x->value));
z->inputs = {x};
z->backward_fn = [x, z]() {
x->grad += z->grad * (x->value > 0 ? 1.0 : 0.0);
};
return tape.record(z);
}
// Phi (smooth): z = 1/(1 + sqrt((x-1)^2 + T)), differentiable consciousnessExact original notation
ReLU: z = max(0, x), dz/dx = (x > 0) ? 1 : 0