ThresholdedRelu - version 10#

This page documents version 10 of operator ThresholdedRelu. See ThresholdedRelu for the latest version (since version 22).

  • Domain: ai.onnx

  • Since version: 10

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.

Inputs

  • X (T): Input tensor

Outputs

  • Y (T): Output tensor

Attributes

  • alpha (float): Threshold value

Type Constraints

  • T: Constrain input and output types to float tensors. Allowed types: tensor(double), tensor(float), tensor(float16).

Examples#

test_cc_thresholdedrelu

Node:
  ThresholdedRelu(X) -> (Y)
  Attributes:
    alpha = 2.0
Inputs:
  X: shape=(2, 3), dtype=float32
    [[-1. ,  0. ,  1. ],
     [ 2. ,  2.5,  3. ]]

Outputs:
  Y: shape=(2, 3), dtype=float32
    [[0. , 0. , 0. ],
     [0. , 2.5, 3. ]]

test_cc_thresholdedrelu_default

Node:
  ThresholdedRelu(X) -> (Y)
Inputs:
  X: shape=(2, 3), dtype=float32
    [[-1. ,  0. ,  0.5],
     [ 1. ,  1.5,  2. ]]

Outputs:
  Y: shape=(2, 3), dtype=float32
    [[0. , 0. , 0. ],
     [0. , 1.5, 2. ]]

test_cc_thresholdedrelu_example

Node:
  ThresholdedRelu(X) -> (Y)
  Attributes:
    alpha = 2.0
Inputs:
  X: shape=(3, 4, 5), dtype=float32
    [[[3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.]],

     [[3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.]],

     [[3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.]]]

Outputs:
  Y: shape=(3, 4, 5), dtype=float32
    [[[3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.]],

     [[3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.]],

     [[3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.],
      [3., 3., 3., 3., 3.]]]