ngraph.opset6.clamp(data: Union[_pyngraph.Node, int, float, numpy.ndarray], min_value: Union[int, float], max_value: Union[int, float], name: Optional[str] = None)_pyngraph.Node

Perform clamp element-wise on data from input node.

  • data – Input tensor. One of: input node, array or scalar.

  • min_value – The lower bound of the <min_value;max_value> range. Scalar value.

  • max_value – The upper bound of the <min_value;max_value> range. Scalar value.

  • name – Optional output node name.


The new node performing a clamp operation on its input data element-wise.

Performs a clipping operation on an input value between a pair of boundary values.

For each element in data, if the element’s value is lower than min_value, it will be replaced with min_value. If the value is higher than max_value, it will be replaced by max_value. Intermediate values of data are returned without change.

Clamp uses the following logic:

if data < min_value:
elif data > max_value: