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
0 | 0 | PRelu takes input data (Tensor | PRelu takes input data (Tensor |
1 | 1 | output data (Tensor | output data (Tensor |
2 | 2 | f(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. | ||
3 | 6 | This 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 |
4 | 7 |
|
|
5 | 8 | **Inputs** | **Inputs** |
6 | 9 |
|
|
7 | 10 | * **X** (heterogeneous) - **T**: | * **X** (heterogeneous) - **T**: |
8 | 11 | Input tensor | Input tensor |
9 | 12 | * **slope** (heterogeneous) - **T**: | * **slope** (heterogeneous) - **T**: |
10 | 13 | 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; |
11 | 14 | if so, its shape must be unidirectional broadcastable to X | if so, its shape must be unidirectional broadcastable to X |
12 | 15 |
|
|
13 | 16 | **Outputs** | **Outputs** |
14 | 17 |
|
|
15 | 18 | * **Y** (heterogeneous) - **T**: | * **Y** (heterogeneous) - **T**: |
16 | 19 | Output tensor (same size as X) | Output tensor (same size as X) |
17 | 20 |
|
|
18 | 21 | **Type Constraints** | **Type Constraints** |
19 | 22 |
|
|
20 | 23 | * **T** in ( | * **T** in ( |
24 | tensor(bfloat16), | ||
21 | 25 | tensor(double), | tensor(double), |
22 | 26 | tensor(float), | tensor(float), |
23 | 27 | tensor(float16), | tensor(float16), |
24 | 28 | tensor(int32), | tensor(int32), |
25 | 29 | tensor(int64), | tensor(int64), |
26 | 30 | tensor(uint32), | tensor(uint32), |
27 | 31 | tensor(uint64) | tensor(uint64) |
28 | 32 | ): | ): |
29 | 33 | 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
0 | 0 | PRelu takes input data (Tensor | PRelu takes input data (Tensor |
1 | 1 | output data (Tensor | output data (Tensor |
2 | 2 | f(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 | 3 | This 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 |
4 | 4 |
|
|
5 | 5 | **Inputs** | **Inputs** |
6 | 6 |
|
|
7 | 7 | * **X** (heterogeneous) - **T**: | * **X** (heterogeneous) - **T**: |
8 | 8 | Input tensor | Input tensor |
9 | 9 | * **slope** (heterogeneous) - **T**: | * **slope** (heterogeneous) - **T**: |
10 | 10 | 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; |
11 | 11 | if so, its shape must be unidirectional broadcastable to X | if so, its shape must be unidirectional broadcastable to X |
12 | 12 |
|
|
13 | 13 | **Outputs** | **Outputs** |
14 | 14 |
|
|
15 | 15 | * **Y** (heterogeneous) - **T**: | * **Y** (heterogeneous) - **T**: |
16 | 16 | Output tensor (same size as X) | Output tensor (same size as X) |
17 | 17 |
|
|
18 | 18 | **Type Constraints** | **Type Constraints** |
19 | 19 |
|
|
20 | 20 | * **T** in ( | * **T** in ( |
21 | 21 | tensor(double), | tensor(double), |
22 | 22 | tensor(float), | tensor(float), |
23 | 23 | tensor(float16) |
|
24 | tensor(int32), | ||
25 | tensor(int64), | ||
26 | tensor(uint32), | ||
27 | tensor(uint64) | ||
24 | 28 | ): | ): |
25 | 29 | Constrain input and output types to float 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
0 | 0 | PRelu takes input data (Tensor | PRelu takes input data (Tensor |
1 | 1 | output data (Tensor | output data (Tensor |
2 | 2 | f(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 | This operator supports **unidirectional broadcasting** (tensor slope should be unidirectional broadcastable to input tensor X); for more details please check Broadcasting in ONNX | ||
3 | 4 |
|
|
4 | 5 | **Inputs** | **Inputs** |
5 | 6 |
|
|
6 | 7 | * **X** (heterogeneous) - **T**: | * **X** (heterogeneous) - **T**: |
7 | 8 | Input tensor | Input tensor |
8 | 9 | * **slope** (heterogeneous) - **T**: | * **slope** (heterogeneous) - **T**: |
9 | 10 | Slope tensor. If Slope is of size 1, the value is sharedacross |
|
10 | 11 | different channels |
|
11 | 12 |
|
|
12 | 13 | **Outputs** | **Outputs** |
13 | 14 |
|
|
14 | 15 | * **Y** (heterogeneous) - **T**: | * **Y** (heterogeneous) - **T**: |
15 | 16 | Output tensor |
|
16 | 17 |
|
|
17 | 18 | **Type Constraints** | **Type Constraints** |
18 | 19 |
|
|
19 | 20 | * **T** in ( | * **T** in ( |
20 | 21 | tensor(double), | tensor(double), |
21 | 22 | tensor(float), | tensor(float), |
22 | 23 | tensor(float16) | tensor(float16) |
23 | 24 | ): | ): |
24 | 25 | 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
0 | 0 | PRelu takes input data (Tensor | PRelu takes input data (Tensor |
1 | 1 | output data (Tensor | output data (Tensor |
2 | 2 | f(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 | 3 |
|
|
4 | **Attributes** | ||
5 |
| ||
6 | * **consumed_inputs**: | ||
7 | legacy optimization attribute. | ||
8 |
| ||
9 | 4 | **Inputs** | **Inputs** |
10 | 5 |
|
|
11 | 6 | * **X** (heterogeneous) - **T**: | * **X** (heterogeneous) - **T**: |
12 | 7 | Input tensor | Input tensor |
13 | 8 | * **slope** (heterogeneous) - **T**: | * **slope** (heterogeneous) - **T**: |
14 | 9 | Slope tensor. If Slope is of size 1, the value is sharedacross | Slope tensor. If Slope is of size 1, the value is sharedacross |
15 | 10 | different channels | different channels |
16 | 11 |
|
|
17 | 12 | **Outputs** | **Outputs** |
18 | 13 |
|
|
19 | 14 | * **Y** (heterogeneous) - **T**: | * **Y** (heterogeneous) - **T**: |
20 | 15 | Output tensor | Output tensor |
21 | 16 |
|
|
22 | 17 | **Type Constraints** | **Type Constraints** |
23 | 18 |
|
|
24 | 19 | * **T** in ( | * **T** in ( |
25 | 20 | tensor(double), | tensor(double), |
26 | 21 | tensor(float), | tensor(float), |
27 | 22 | tensor(float16) | tensor(float16) |
28 | 23 | ): | ): |
29 | 24 | 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.