tfc.ops.upper_bound

View source on GitHub

Same as tf.minimum, but with helpful gradient for inputs > bound.

View aliases

Main aliases

tfc.upper_bound

tfc.ops.upper_bound(
 inputs,
 bound,
 gradient='identity_if_towards',
 name='upper_bound'
)

This function behaves just like tf.minimum, but the behavior of the gradient with respect to inputs for input values that hit the bound depends on gradient:

If set to 'disconnected', the returned gradient is zero for values that hit the bound. This is identical to the behavior of tf.minimum.

If set to 'identity', the gradient is unconditionally replaced with the identity function (i.e., pretending this function does not exist).

If set to 'identity_if_towards', the gradient is replaced with the identity function, but only if applying gradient descent would push the values of inputs towards the bound. For gradient values that push away from the bound, the returned gradient is still zero.

Args

inputs Input tensor.
bound Upper bound for the input tensor.
gradient 'disconnected', 'identity', or 'identity_if_towards' (default).
name Name for this op.

Returns

tf.minimum(inputs, bound)

Raises

ValueError for invalid value of gradient.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.

Last updated 2024年04月26日 UTC.