chainer.functions.sign

chainer.functions.sign(x)[source]

Elementwise sign function.

For a given input x, this function returns sgn(x) defined as

sgn(x)={1if x<00if x=01if x>0

Note

The gradient of this function is None everywhere and therefore unchains the computational graph.

Parameters

x (Variable or N-dimensional array) – Input variable for which the sign is computed.

Returns

Output variable.

Return type

Variable