sign

dragon.math.sign(
  inputs,
  **kwargs
)[source]

Compute the sign indication of input.

\[\text{out}_[i] = \begin{cases} -1, & \text{ if } \text{input}_{i} < 0 \\ 0, & \text{ if } \text{input}_{i} = 0 \\ 1, & \text{ if } \text{input}_{i} > 0 \end{cases} \]

Examples:

x = dragon.constant([-2, 0, 2])
print(dragon.math.sign(x))  # [-1, 0, 1]
Parameters:
Returns:

dragon.Tensor The output tensor.