Python wrappers
Public Python APIs implemented by this engine symbol.Autograd node for element-wise negation .
The gradient is the negation of the upstream signal; no input or output
needs to be saved because the rule contains no functional dependence on
. kSavesInput = false opts out of the default save behaviour
provided by UnaryKernel.
Math
\frac{\partial \mathcal{L}}{\partial x} = -\frac{\partial \mathcal{L}} {\partial y}.$$Attributes
schema_v1OpSchemaRegistered as
"neg" with AmpPolicy::Promote — integer inputs are upcast to float before dispatch so the algebraic identity holds for the same dtype on the return path.kSavesInputboolfalse. Backward needs no saved value.Notes
Dispatch: Accelerate vDSP_vneg (CPU) / MLX negative (GPU).