Clamp#
Versioned name: Clamp-1
Category: Activation function
Short description: Clamp operation represents clipping activation function.
Detailed description:
Clamp performs clipping operation over the input tensor element-wise. Element values of the output are within the range [min, max].
- Input values that are smaller than min are replaced with min value. 
- Input values that are greater than max are replaced with max value. 
- Input values within the range - [min, max]remain unchanged.
Let min_value and max_value be min and max, respectively. The mathematical formula of Clamp is as follows:
Attributes:
- min - Description: min is the lower bound of values in the output. 
- Range of values: arbitrary floating-point number 
- Type: - float
- Required: yes 
 
- max - Description: max is the upper bound of values in the output. 
- Range of values: arbitrary floating-point number 
- Type: - float
- Required: yes 
 
Inputs:
- 1: A tensor of type T and arbitrary shape. Required. 
Outputs:
- 1: A tensor of type T with same shape as input tensor. 
Types
- T: any numeric type. 
- Note: In case of integral numeric type, ceil is used to convert min from - floatto T and floor is used to convert max from- floatto T.
Example
<layer id="1" name="clamp_node" type="Clamp">
    <data min="10" max="50" />
    <input>
        <port id="0">
            <dim>256</dim>
        </port>
    </input>
    <output>
        <port id="1">
            <dim>256</dim>
        </port>
    </output>
</layer>