chainer.functions.sign¶
-
chainer.functions.
sign
(x)[source]¶ Elementwise sign function.
For a given input \(x\), this function returns \(sgn(x)\) defined as
\[\begin{split}sgn(x) = \left \{ \begin{array}{cc} -1 & {\rm if~x < 0} \\ 0 & {\rm if~x = 0} \\ 1 & {\rm if~x > 0} \\ \end{array} \right.\end{split}\]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