# tensorplay.functional.sgn Source: https://www.tensorplay.cn/docs/generated/tensorplay.functional.sgn.html ```python tensorplay.functional.sgn(input, *, out=None) → Tensor ``` This function is an extension of tensorplay.sign() to complex tensors. It computes a new tensor whose elements have the same angles as the corresponding elements of input and absolute values (i.e. magnitudes) of one for complex tensors and is equivalent to tensorplay.sign() for non-complex tensors. $$\begin{split}\text{out}_{i} = \begin{cases} 0 & |\text{{input}}_i| == 0 \\ \frac{{\text{{input}}_i}}{|{\text{{input}}_i}|} & \text{otherwise} \end{cases}\end{split}$$ Parameters: input ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – the input tensor. Keyword Arguments: out ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor), optional) – the output tensor. Example: ``` >>> t = tensorplay.tensor([3+4j, 7-24j, 0, 1+2j]) >>> t.sgn() tensor([0.6000+0.8000j, 0.2800-0.9600j, 0.0000+0.0000j, 0.4472+0.8944j]) ```