# 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

```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")
```

Differences

 `0` `0` `Calculate the sign of the given input tensor element-wise.` `Calculate the sign of the given input tensor element-wise.` `1` `1` `If input > 0, output 1. if input < 0, output -1. if input == 0, output 0.` `If input > 0, output 1. if input < 0, output -1. if input == 0, output 0.` `2` `2` `3` `3` `**Inputs**` `**Inputs**` `4` `4` `5` `5` `* **input** (heterogeneous) - **T**:` `* **input** (heterogeneous) - **T**:` `6` `6` ` Input tensor` ` Input tensor` `7` `7` `8` `8` `**Outputs**` `**Outputs**` `9` `9` `10` `10` `* **output** (heterogeneous) - **T**:` `* **output** (heterogeneous) - **T**:` `11` `11` ` The sign of the input tensor computed element-wise. It has the same` ` The sign of the input tensor computed element-wise. It has the same` `12` `12` ` shape and type of the input.` ` shape and type of the input.` `13` `13` `14` `14` `**Type Constraints**` `**Type Constraints**` `15` `15` `16` `16` `* **T** in (` `* **T** in (` `17` ` tensor(bfloat16),` `17` `18` ` tensor(double),` ` tensor(double),` `18` `19` ` tensor(float),` ` tensor(float),` `19` `20` ` tensor(float16),` ` tensor(float16),` `20` `21` ` tensor(int16),` ` tensor(int16),` `21` `22` ` tensor(int32),` ` tensor(int32),` `22` `23` ` tensor(int64),` ` tensor(int64),` `23` `24` ` tensor(int8),` ` tensor(int8),` `24` `25` ` tensor(uint16),` ` tensor(uint16),` `25` `26` ` tensor(uint32),` ` tensor(uint32),` `26` `27` ` tensor(uint64),` ` tensor(uint64),` `27` `28` ` tensor(uint8)` ` tensor(uint8)` `28` `29` ` ):` ` ):` `29` `30` ` Constrain input and output types to all numeric tensors.` ` Constrain input and output types to all numeric tensors.`

## 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.