Read the equation
The comment gives log(x) and derivative 1/x, but the body evaluates log(x+EPSILON) and derivative 1/(x+EPSILON). This positive shift changes both the value and the domain to x+EPSILON>0. It mitigates a zero input but does not make every negative input valid.
Terms & definitions
| Term | Meaning in this source |
|---|---|
| x | Input |
| EPSILON | Added numerical offset |
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, e]() {
x->grad += z->grad * e;
};
return tape.record(z);
}
// Log: z = log(x), dz/dx = 1/x
inline GradNodePtr log_op(GradNodePtr x, TapeRecorder& tape) {
auto z = std::make_shared<GradNode>(std::log(x->value + EPSILON));
z->inputs = {x};
z->backward_fn = [x, z]() {
x->grad += z->grad / (x->value + EPSILON);
};
return tape.record(z);
}
// Power: z = x^p, dz/dx = p * x^(p-1)Exact original notation
Log: z = log(x), dz/dx = 1/x