clip
Function Usage
Clipping API of the tensor class. It is used to limit elements in a tensor between the specified minimum value and maximum value (elements smaller than the minimum value will be replaced with the minimum value, and elements greater than the maximum value will be replaced with the maximum value).
It is supported by the Atlas inference product and
- The input and output tensors must be on the device.
- The shape of the input tensor cannot exceed four dimensions.
Prototype
clip(inputTensor: Tensor, minVal: float, maxVal: float)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
inputTensor |
Input |
Tensor class, supporting dtype.float16, dtype.float32, and dtype.uint8 data types. |
minVal |
Input |
Float type, minimum value after clipping in a tensor. Elements smaller than the minimum value will be replaced with the minimum value. The value of minVal must be less than or equal to that of maxVal. |
maxVal |
Input |
Float type, maximum value after clipping in a tensor. Elements greater than the maximum value will be replaced with the maximum value. The value of maxVal must be greater than or equal to that of minVal. |
Response Parameters
Clipped tensor data