# mlx.core.stop_gradient — MLX 0.0.7 documentation

Skip to main content
`Ctrl`+`K`

# mlx.core.stop_gradient

mlx.core.stop_gradient(a: array, /, *, stream: Union[ None , Stream , Device ] = None) → array

  Stop gradients from being computed.

  The operation is the identity but it prevents gradients from flowing through the array.

  Parameters:

    a (array) – Input array.

  Returns:

    The unchanged input `a` but without gradient flowing

      through it.

  Return type:

    array