PRelu#

PRelu - 16#

Version

  • name: PRelu (GitHub)

  • domain: main

  • since_version: 16

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 16.

Summary

PRelu takes input data (Tensor<T>) and slope tensor as input, and produces one output data (Tensor<T>) where the function f(x) = slope * x for x < 0, f(x) = x for x >= 0., is applied to the data tensor elementwise.

History - Version 16 adds bfloat16 to the types allowed. This operator supports unidirectional broadcasting (tensor slope should be unidirectional broadcastable to input tensor X); for more details please check Broadcasting in ONNX.

Inputs

  • X (heterogeneous) - T: Input tensor

  • slope (heterogeneous) - T: Slope tensor. The shape of slope can be smaller then first input X; if so, its shape must be unidirectional broadcastable to X

Outputs

  • Y (heterogeneous) - T: Output tensor (same size as X)

Type Constraints

  • T in ( tensor(bfloat16), tensor(double), tensor(float), tensor(float16), tensor(int32), tensor(int64), tensor(uint32), tensor(uint64) ): Constrain input and output types to float/int tensors.

Examples

prelu_broadcast

node = onnx.helper.make_node(
    'PRelu',
    inputs=['x', 'slope'],
    outputs=['y'],
)

x = np.random.randn(3, 4, 5).astype(np.float32)
slope = np.random.randn(5).astype(np.float32)
y = np.clip(x, 0, np.inf) + np.clip(x, -np.inf, 0) * slope

expect(node, inputs=[x, slope], outputs=[y],
       name='test_prelu_broadcast')

Differences

00PRelu takes input data (Tensor) and slope tensor as input, and produces onePRelu takes input data (Tensor) and slope tensor as input, and produces one
11output data (Tensor) where the function f(x) = slope * x for x < 0,output data (Tensor) where the function f(x) = slope * x for x < 0,
22f(x) = x for x >= 0., is applied to the data tensor elementwise.f(x) = x for x >= 0., is applied to the data tensor elementwise.
3
4**History**
5- Version 16 adds bfloat16 to the types allowed.
36This operator supports **unidirectional broadcasting** (tensor slope should be unidirectional broadcastable to input tensor X); for more details please check Broadcasting in ONNX _.This operator supports **unidirectional broadcasting** (tensor slope should be unidirectional broadcastable to input tensor X); for more details please check Broadcasting in ONNX _.
47
58**Inputs****Inputs**
69
710* **X** (heterogeneous) - **T**:* **X** (heterogeneous) - **T**:
811 Input tensor Input tensor
912* **slope** (heterogeneous) - **T**:* **slope** (heterogeneous) - **T**:
1013 Slope tensor. The shape of slope can be smaller then first input X; Slope tensor. The shape of slope can be smaller then first input X;
1114 if so, its shape must be unidirectional broadcastable to X if so, its shape must be unidirectional broadcastable to X
1215
1316**Outputs****Outputs**
1417
1518* **Y** (heterogeneous) - **T**:* **Y** (heterogeneous) - **T**:
1619 Output tensor (same size as X) Output tensor (same size as X)
1720
1821**Type Constraints****Type Constraints**
1922
2023* **T** in (* **T** in (
24 tensor(bfloat16),
2125 tensor(double), tensor(double),
2226 tensor(float), tensor(float),
2327 tensor(float16), tensor(float16),
2428 tensor(int32), tensor(int32),
2529 tensor(int64), tensor(int64),
2630 tensor(uint32), tensor(uint32),
2731 tensor(uint64) tensor(uint64)
2832 ): ):
2933 Constrain input and output types to float/int tensors. Constrain input and output types to float/int tensors.

PRelu - 9#

Version

  • name: PRelu (GitHub)

  • domain: main

  • since_version: 9

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 9.

Summary

PRelu takes input data (Tensor<T>) and slope tensor as input, and produces one output data (Tensor<T>) where the function f(x) = slope * x for x < 0, f(x) = x for x >= 0., is applied to the data tensor elementwise. This operator supports unidirectional broadcasting (tensor slope should be unidirectional broadcastable to input tensor X); for more details please check Broadcasting in ONNX.

Inputs

  • X (heterogeneous) - T: Input tensor

  • slope (heterogeneous) - T: Slope tensor. The shape of slope can be smaller then first input X; if so, its shape must be unidirectional broadcastable to X

Outputs

  • Y (heterogeneous) - T: Output tensor (same size as X)

Type Constraints

  • T in ( tensor(double), tensor(float), tensor(float16), tensor(int32), tensor(int64), tensor(uint32), tensor(uint64) ): Constrain input and output types to float/int tensors.

Differences

00PRelu takes input data (Tensor) and slope tensor as input, and produces onePRelu takes input data (Tensor) and slope tensor as input, and produces one
11output data (Tensor) where the function f(x) = slope * x for x < 0,output data (Tensor) where the function f(x) = slope * x for x < 0,
22f(x) = x for x >= 0., is applied to the data tensor elementwise.f(x) = x for x >= 0., is applied to the data tensor elementwise.
33This operator supports **unidirectional broadcasting** (tensor slope should be unidirectional broadcastable to input tensor X); for more details please check Broadcasting in ONNX _.This operator supports **unidirectional broadcasting** (tensor slope should be unidirectional broadcastable to input tensor X); for more details please check Broadcasting in ONNX _.
44
55**Inputs****Inputs**
66
77* **X** (heterogeneous) - **T**:* **X** (heterogeneous) - **T**:
88 Input tensor Input tensor
99* **slope** (heterogeneous) - **T**:* **slope** (heterogeneous) - **T**:
1010 Slope tensor. The shape of slope can be smaller then first input X; Slope tensor. The shape of slope can be smaller then first input X;
1111 if so, its shape must be unidirectional broadcastable to X if so, its shape must be unidirectional broadcastable to X
1212
1313**Outputs****Outputs**
1414
1515* **Y** (heterogeneous) - **T**:* **Y** (heterogeneous) - **T**:
1616 Output tensor (same size as X) Output tensor (same size as X)
1717
1818**Type Constraints****Type Constraints**
1919
2020* **T** in (* **T** in (
2121 tensor(double), tensor(double),
2222 tensor(float), tensor(float),
2323 tensor(float16) tensor(float16),
24 tensor(int32),
25 tensor(int64),
26 tensor(uint32),
27 tensor(uint64)
2428 ): ):
2529 Constrain input and output types to float tensors. Constrain input and output types to float/int tensors.

PRelu - 7#

Version

  • name: PRelu (GitHub)

  • domain: main

  • since_version: 7

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 7.

Summary

PRelu takes input data (Tensor<T>) and slope tensor as input, and produces one output data (Tensor<T>) where the function f(x) = slope * x for x < 0, f(x) = x for x >= 0., is applied to the data tensor elementwise. This operator supports unidirectional broadcasting (tensor slope should be unidirectional broadcastable to input tensor X); for more details please check Broadcasting in ONNX.

Inputs

  • X (heterogeneous) - T: Input tensor

  • slope (heterogeneous) - T: Slope tensor. The shape of slope can be smaller then first input X; if so, its shape must be unidirectional broadcastable to X

Outputs

  • Y (heterogeneous) - T: Output tensor (same size as X)

Type Constraints

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

Differences

00PRelu takes input data (Tensor) and slope tensor as input, and produces onePRelu takes input data (Tensor) and slope tensor as input, and produces one
11output data (Tensor) where the function f(x) = slope * x for x < 0,output data (Tensor) where the function f(x) = slope * x for x < 0,
22f(x) = x for x >= 0., is applied to the data tensor elementwise.f(x) = x for x >= 0., is applied to the data tensor elementwise.
3This operator supports **unidirectional broadcasting** (tensor slope should be unidirectional broadcastable to input tensor X); for more details please check Broadcasting in ONNX _.
34
45**Inputs****Inputs**
56
67* **X** (heterogeneous) - **T**:* **X** (heterogeneous) - **T**:
78 Input tensor Input tensor
89* **slope** (heterogeneous) - **T**:* **slope** (heterogeneous) - **T**:
910 Slope tensor. If Slope is of size 1, the value is sharedacross Slope tensor. The shape of slope can be smaller then first input X;
1011 different channels if so, its shape must be unidirectional broadcastable to X
1112
1213**Outputs****Outputs**
1314
1415* **Y** (heterogeneous) - **T**:* **Y** (heterogeneous) - **T**:
1516 Output tensor Output tensor (same size as X)
1617
1718**Type Constraints****Type Constraints**
1819
1920* **T** in (* **T** in (
2021 tensor(double), tensor(double),
2122 tensor(float), tensor(float),
2223 tensor(float16) tensor(float16)
2324 ): ):
2425 Constrain input and output types to float tensors. Constrain input and output types to float tensors.

PRelu - 6#

Version

  • name: PRelu (GitHub)

  • domain: main

  • since_version: 6

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 6.

Summary

PRelu takes input data (Tensor<T>) and slope tensor as input, and produces one output data (Tensor<T>) where the function f(x) = slope * x for x < 0, f(x) = x for x >= 0., is applied to the data tensor elementwise.

Inputs

  • X (heterogeneous) - T: Input tensor

  • slope (heterogeneous) - T: Slope tensor. If Slope is of size 1, the value is sharedacross different channels

Outputs

  • Y (heterogeneous) - T: Output tensor

Type Constraints

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

Differences

00PRelu takes input data (Tensor) and slope tensor as input, and produces onePRelu takes input data (Tensor) and slope tensor as input, and produces one
11output data (Tensor) where the function f(x) = slope * x for x < 0,output data (Tensor) where the function f(x) = slope * x for x < 0,
22f(x) = x for x >= 0., is applied to the data tensor elementwise.f(x) = x for x >= 0., is applied to the data tensor elementwise.
33
4**Attributes**
5
6* **consumed_inputs**:
7 legacy optimization attribute.
8
94**Inputs****Inputs**
105
116* **X** (heterogeneous) - **T**:* **X** (heterogeneous) - **T**:
127 Input tensor Input tensor
138* **slope** (heterogeneous) - **T**:* **slope** (heterogeneous) - **T**:
149 Slope tensor. If Slope is of size 1, the value is sharedacross Slope tensor. If Slope is of size 1, the value is sharedacross
1510 different channels different channels
1611
1712**Outputs****Outputs**
1813
1914* **Y** (heterogeneous) - **T**:* **Y** (heterogeneous) - **T**:
2015 Output tensor Output tensor
2116
2217**Type Constraints****Type Constraints**
2318
2419* **T** in (* **T** in (
2520 tensor(double), tensor(double),
2621 tensor(float), tensor(float),
2722 tensor(float16) tensor(float16)
2823 ): ):
2924 Constrain input and output types to float tensors. Constrain input and output types to float tensors.

PRelu - 1#

Version

  • name: PRelu (GitHub)

  • domain: main

  • since_version: 1

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: False

This version of the operator has been available since version 1.

Summary

PRelu takes input data (Tensor<T>) and slope tensor as input, and produces one output data (Tensor<T>) where the function f(x) = slope * x for x < 0, f(x) = x for x >= 0., is applied to the data tensor elementwise.

Attributes

  • consumed_inputs: legacy optimization attribute.

Inputs

  • X (heterogeneous) - T: Input tensor

  • slope (heterogeneous) - T: Slope tensor. If Slope is of size 1, the value is sharedacross different channels

Outputs

  • Y (heterogeneous) - T: Output tensor

Type Constraints

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