Sign#
Sign - 13#
Version
name: Sign (GitHub)
domain: main
since_version: 13
function: False
support_level: SupportType.COMMON
shape inference: True
This version of the operator has been available since version 13.
Summary
Calculate the sign of the given input tensor element-wise. If input > 0, output 1. if input < 0, output -1. if input == 0, output 0.
Inputs
input (heterogeneous) - T: Input tensor
Outputs
output (heterogeneous) - T: The sign of the input tensor computed element-wise. It has the same shape and type of the input.
Type Constraints
T in ( tensor(bfloat16), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ): Constrain input and output types to all numeric tensors.
Examples
default
import numpy as np
import onnx
node = onnx.helper.make_node(
"Sign",
inputs=["x"],
outputs=["y"],
)
x = np.array(range(-5, 6)).astype(np.float32)
y = np.sign(x)
expect(node, inputs=[x], outputs=[y], name="test_sign")
Sign - 9#
Version
name: Sign (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
Calculate the sign of the given input tensor element-wise. If input > 0, output 1. if input < 0, output -1. if input == 0, output 0.
Inputs
input (heterogeneous) - T: Input tensor
Outputs
output (heterogeneous) - T: The sign of the input tensor computed element-wise. It has the same shape and type of the input.
Type Constraints
T in ( tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ): Constrain input and output types to all numeric tensors.