Returns the variance of all elements in the x tensor. If unbiased is FALSE, then the variance will be calculated via the biased estimator. Otherwise, Bessel’s correction will be used.

tch_var(x, unbiased = TRUE, dim = NULL, keepdim = FALSE)

Arguments

x

tensor object

unbiased

whether to use the unbiased estimation or not

dim

the dimension to reduce

keepdim

wether to keep or not the dim

Examples

x <- tensor(runif(100)) tch_var(x)
#> tensor #> 0.0728872 #> [ Variable[CPUFloatType]{} ]