MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / clip

Function clip

tensorflow/python/keras/backend.py:2198–2215  ·  view source on GitHub ↗

Element-wise value clipping. Arguments: x: Tensor or variable. min_value: Python float or integer. max_value: Python float or integer. Returns: A tensor.

(x, min_value, max_value)

Source from the content-addressed store, hash-verified

2196
2197@keras_export('keras.backend.clip')
2198def clip(x, min_value, max_value):
2199 """Element-wise value clipping.
2200
2201 Arguments:
2202 x: Tensor or variable.
2203 min_value: Python float or integer.
2204 max_value: Python float or integer.
2205
2206 Returns:
2207 A tensor.
2208 """
2209 if max_value is not None and max_value < min_value:
2210 max_value = min_value
2211 if max_value is None:
2212 max_value = np.inf
2213 min_value = _constant_to_tensor(min_value, x.dtype.base_dtype)
2214 max_value = _constant_to_tensor(max_value, x.dtype.base_dtype)
2215 return clip_ops.clip_by_value(x, min_value, max_value)
2216
2217
2218@keras_export('keras.backend.equal')

Callers 1

SegmentOffsetsKernelFunction · 0.85

Calls 1

_constant_to_tensorFunction · 0.85

Tested by

no test coverage detected