% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gen-namespace-docs.R,
%   R/gen-namespace-examples.R, R/gen-namespace.R
\name{torch_sgn}
\alias{torch_sgn}
\title{Sgn}
\usage{
torch_sgn(self)
}
\arguments{
\item{self}{(Tensor) the input tensor.}
}
\description{
Sgn
}
\section{sgn(input, *, out=None) -> Tensor }{


For complex tensors, this function returns a new tensor whose elemants have the same angle as that of the
elements of \code{input} and absolute value 1. For a non-complex tensor, this function
returns the signs of the elements of \code{input} (see \code{\link{torch_sign}}).

\eqn{\mbox{out}_{i} = 0}, if \eqn{|{\mbox{{input}}_i}| == 0}
\eqn{\mbox{out}_{i} = \frac{{\mbox{{input}}_i}}{|{\mbox{{input}}_i}|}}, otherwise
}

\examples{
if (torch_is_installed()) {
if (FALSE) {
x <- torch_tensor(c(3+4i, 7-24i, 0, 1+2i))
x$sgn()
torch_sgn(x)
}
}
}
