Given a tensor t, this operation returns a tensor of the same type and
shape as t with its values clipped to clip_value_min and clip_value_max.
Any values less than clip_value_min are set to clip_value_min. Any values
greater than clip_value_max are set to clip_value_max.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.clip_by_value\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 1 version](/versions/r1.15/api_docs/python/tf/clip_by_value) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/clip_ops.py#L36-L93) |\n\nClips tensor values to a specified min and max.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.clip_by_value`](/api_docs/python/tf/clip_by_value)\n\n\u003cbr /\u003e\n\n tf.clip_by_value(\n t, clip_value_min, clip_value_max, name=None\n )\n\nGiven a tensor `t`, this operation returns a tensor of the same type and\nshape as `t` with its values clipped to `clip_value_min` and `clip_value_max`.\nAny values less than `clip_value_min` are set to `clip_value_min`. Any values\ngreater than `clip_value_max` are set to `clip_value_max`.\n| **Note:** `clip_value_min` needs to be smaller or equal to `clip_value_max` for correct results.\n\n#### For example:\n\n A = tf.constant([[1, 20, 13], [3, 21, 13]])\n B = tf.clip_by_value(A, clip_value_min=0, clip_value_max=3) # [[1, 3, 3],[3, 3, 3]]\n C = tf.clip_by_value(A, clip_value_min=0., clip_value_max=3.) # throws `TypeError`\n as input and clip_values are of different dtype\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------------|--------------------------------------------------------------------------------------------------|\n| `t` | A `Tensor` or `IndexedSlices`. |\n| `clip_value_min` | A 0-D (scalar) `Tensor`, or a `Tensor` with the same shape as `t`. The minimum value to clip by. |\n| `clip_value_max` | A 0-D (scalar) `Tensor`, or a `Tensor` with the same shape as `t`. The maximum value to clip by. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A clipped `Tensor` or `IndexedSlices`. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `ValueError` | If the clip tensors would trigger array broadcasting that would make the returned tensor larger than the input. |\n| `TypeError` | If dtype of the input is `int32` and dtype of the `clip_value_min` or `clip_value_max` is `float32` |\n\n\u003cbr /\u003e"]]