torch.var¶
-
torch.var(input, dim, unbiased, keepdim=False, *, out=None) → Tensor¶ If
unbiasedisTrue, Bessel’s correction will be used. Otherwise, the sample variance is calculated, without any correction.- Parameters
- Keyword Arguments
-
torch.var(input, unbiased) → Tensor
Calculates the variance of all elements in the
inputtensor.If
unbiasedisTrue, Bessel’s correction will be used. Otherwise, the sample deviation is calculated, without any correction.- Parameters
Example:
>>> a = torch.tensor([[-0.8166, -1.3802, -0.3560]]) >>> torch.var(a, unbiased=False) tensor(0.1754)