(l-onnx-doc-ThresholdedRelu)= # ThresholdedRelu (l-onnx-op-thresholdedrelu-22)= ## ThresholdedRelu - 22 ### Version - **name**: [ThresholdedRelu (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#ThresholdedRelu) - **domain**: `main` - **since_version**: `22` - **function**: `True` - **support_level**: `SupportType.COMMON` - **shape inference**: `True` This version of the operator has been available **since version 22**. ### Summary ThresholdedRelu takes one input data (Tensor) and produces one output data (Tensor) where the rectified linear function, y = x for x > alpha, y = 0 otherwise, is applied to the tensor elementwise. #### Function Body The function definition for this operator. ``` < domain: "", opset_import: ["" : 18] > ThresholdedRelu (X) => (Y) { Alpha = Constant () AlphaCast = CastLike (Alpha, X) Zero = Constant () ZeroCast = CastLike (Zero, X) AlphaLessThanX = Less (AlphaCast, X) Y = Where (AlphaLessThanX, X, ZeroCast) } ``` ### Attributes * **alpha - FLOAT** (default is `'1.0'`): Threshold value ### Inputs - **X** (heterogeneous) - **T**: Input tensor ### Outputs - **Y** (heterogeneous) - **T**: Output tensor ### Type Constraints * **T** in ( `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` ): Constrain input and output types to float tensors. ```{toctree} text_diff_ThresholdedRelu_10_22 ``` (l-onnx-op-thresholdedrelu-10)= ## ThresholdedRelu - 10 ### Version - **name**: [ThresholdedRelu (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#ThresholdedRelu) - **domain**: `main` - **since_version**: `10` - **function**: `True` - **support_level**: `SupportType.COMMON` - **shape inference**: `True` This version of the operator has been available **since version 10**. ### Summary ThresholdedRelu takes one input data (Tensor) and produces one output data (Tensor) where the rectified linear function, y = x for x > alpha, y = 0 otherwise, is applied to the tensor elementwise. #### Function Body The function definition for this operator. ``` < domain: "", opset_import: ["" : 18] > ThresholdedRelu (X) => (Y) { Alpha = Constant () AlphaCast = CastLike (Alpha, X) Zero = Constant () ZeroCast = CastLike (Zero, X) AlphaLessThanX = Less (AlphaCast, X) Y = Where (AlphaLessThanX, X, ZeroCast) } ``` ### Attributes * **alpha - FLOAT** (default is `'1.0'`): Threshold value ### Inputs - **X** (heterogeneous) - **T**: Input tensor ### Outputs - **Y** (heterogeneous) - **T**: Output tensor ### Type Constraints * **T** in ( `tensor(double)`, `tensor(float)`, `tensor(float16)` ): Constrain input and output types to float tensors.