Skip to content
fn

sign_op

→TensorImplPtr
int sign_op(const int & a)

Python wrappers

Public Python APIs implemented by this engine symbol.

Compute y=sign(x)∈{−1,0,+1}y = \mathrm{sign}(x) \in \{-1, 0, +1\} element-wise.

Allocates a fresh output of the same shape and dtype as a and delegates to SignBackward::forward. No autograd edge is recorded because sign has a zero gradient almost everywhere.

See Also

SignBackward — backward node.

Parameters

aTensorImplPtr
Input tensor of any real dtype, including integer.

Returns

TensorImplPtr

Output tensor of the same shape and dtype, with values in {−1,0,+1}\{-1, 0, +1\}.