Autograd node for element-wise cube root: .
Unlike sqrt, cube root is real-valued for all real inputs —
negative arguments produce negative outputs and the operation is
monotone increasing. The backward formula divides by , which
is the only undefined point (at ).
Math
Forward
Backward
\frac{\partial L}{\partial y_i}$$ **See Also** `cube_root_op`.Attributes
kSavesInputboolfalse — the input is not needed for the backward pass.kSavesOutputbooltrue — the forward output is saved so the backward pass can compute without re-invoking the cube-root kernel.schema_v1OpSchema"cube_root" with AmpPolicy::ForceFP32 because the cube root is numerically unreliable in half precision (loss of accuracy near zero and for very large magnitudes).Notes
CPU dispatch uses Apple Accelerate's vvcbrtf (vector cube root in
float32); GPU dispatch routes through MLX's power primitive applied
with exponent . The gradient diverges at — callers
should guard against zero inputs if they intend to backpropagate.
Static methods
1Methods
1Computes from the saved output — squaring is cheaper than recomputing .
Parameters
gconst Storage&Returns
StorageGradient with respect to x. Undefined at slots where the saved output is zero (division by zero); callers must avoid differentiating through .