Python wrappers
Public Python APIs implemented by this engine symbol.Autograd node for element-wise clip (clamp): .
The gradient is the in-range indicator: gradient flows through where the input lies strictly between the bounds, and is zero on the saturated boundaries.
Math
Forward
Backward
\frac{\partial L}{\partial y_i} & \text{min} < x_i < \text{max} \\ 0 & \text{otherwise} \end{cases}$$ **See Also** `clip_op`.Attributes
min_doubleLower clamp bound captured at forward.
max_doubleUpper clamp bound captured at forward.
schema_v1OpSchemaOp name
"clip" with AmpPolicy::KeepInput (clip is valid on both integer and floating-point inputs).Notes
min_ and max_ are persisted so grad_formula can rebuild the
in-range mask from the saved input rather than caching the mask itself.
Static methods
1Forward dispatch with bounds capture — computes and wires the backward node manually with both bounds persisted.
Parameters
aconst TensorImplPtr&Input tensor.
min_vdoubleLower bound.
max_vdoubleUpper bound (must satisfy
min_v <= max_v).Returns
TensorImplPtrClamped output tensor with the same shape, dtype, and device as a.