Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tf.keras.backend.stop_gradient

TensorFlow 1 version View source on GitHub

Returns variables but with zero gradient w.r.t. every other variable.

tf.keras.backend.stop_gradient(
    variables
)

Arguments:

  • variables: Tensor or list of tensors to consider constant with respect to any other variable.

Returns:

A single tensor or a list of tensors (depending on the passed argument) that has no gradient with respect to any other variable.