Returns a new tensor with the sign of the elements of x.

tch_sign(x)

Arguments

x

tensor object

Examples

x <- tensor(matrix(rnorm(6), nrow = 3)) tch_sign(x)
#> tensor #> 1 1 #> -1 -1 #> 1 -1 #> [ Variable[CPUFloatType]{3,2} ]