This function behaves just like tf.maximum, 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.maximum.
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
Lower bound for the input tensor.
gradient
'disconnected', 'identity', or 'identity_if_towards' (default).
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tfc.ops.lower_bound\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/compression/blob/v2.14.1/tensorflow_compression/python/ops/math_ops.py#L92-L154) |\n\nSame as [`tf.maximum`](https://www.tensorflow.org/api_docs/python/tf/math/maximum), but with helpful gradient for `inputs \u003c bound`.\n\n#### View aliases\n\n\n**Main aliases**\n\n[`tfc.lower_bound`](https://www.tensorflow.org/api_docs/python/tfc/ops/lower_bound)\n\n\u003cbr /\u003e\n\n tfc.ops.lower_bound(\n inputs,\n bound,\n gradient='identity_if_towards',\n name='lower_bound'\n )\n\nThis function behaves just like [`tf.maximum`](https://www.tensorflow.org/api_docs/python/tf/math/maximum), but the behavior of the gradient\nwith respect to `inputs` for input values that hit the bound depends on\n`gradient`:\n\nIf set to `'disconnected'`, the returned gradient is zero for values that hit\nthe bound. This is identical to the behavior of [`tf.maximum`](https://www.tensorflow.org/api_docs/python/tf/math/maximum).\n\nIf set to `'identity'`, the gradient is unconditionally replaced with the\nidentity function (i.e., pretending this function does not exist).\n\nIf set to `'identity_if_towards'`, the gradient is replaced with the identity\nfunction, but only if applying gradient descent would push the values of\n`inputs` towards the bound. For gradient values that push away from the bound,\nthe returned gradient is still zero.\n| **Note:** In the latter two cases, no gradient is returned for `bound`. Also, the implementation of `gradient == 'identity_if_towards'` currently assumes that the shape of `inputs` is the same as the shape of the output. It won't work reliably for all possible broadcasting scenarios.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------|-----------------------------------------------------------------|\n| `inputs` | Input tensor. |\n| `bound` | Lower bound for the input tensor. |\n| `gradient` | 'disconnected', 'identity', or 'identity_if_towards' (default). |\n| `name` | Name for this op. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| [`tf.maximum(inputs, bound)`](https://www.tensorflow.org/api_docs/python/tf/math/maximum) ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|--------------|----------------------------------|\n| `ValueError` | for invalid value of `gradient`. |\n\n\u003cbr /\u003e"]]