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

Stops gradient computation.

  • 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.


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