mlx.core.stop_gradient

mlx.core.stop_gradient#

stop_gradient(a: array, /, *, stream: None | Stream | Device = None) array#

Stop gradients from being computed.

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

參數:

a (array) -- Input array.

回傳:

The unchanged input a but without gradient flowing through it.

回傳型別:

array