stop_gradient

ivy.stop_gradient(x, preserve_type=True, f=None)[source]

Stops gradient computation.

Parameters
  • x (array) – Array for which to stop the gradient.

  • preserve_type – Whether to preserve the input type (ivy.Variable or ivy.Array), otherwise an array is always returned. Default is True.

  • preserve_type – bool, optional

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

The same array x, but with no gradient information.


Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty