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) -- 輸入陣列。

回傳值:

The unchanged input a but without gradient flowing through it.

回傳值型別:

array