torch.var_mean¶
- torch.var_mean(input, dim, unbiased, keepdim=False, *, out=None)¶
If
unbiased
isTrue
, Bessel’s correction will be used to calculate the variance. Otherwise, the sample variance is calculated, without any correction.- Parameters:
- Keyword Arguments:
- Returns:
A tuple (var, mean) containing the variance and mean.
- torch.var_mean(input, unbiased)
Calculates the variance and mean of all elements in the
input
tensor.If
unbiased
isTrue
, Bessel’s correction will be used. Otherwise, the sample deviation is calculated, without any correction.- Parameters:
- Returns:
A tuple (var, mean) containing the variance and mean.
Example:
>>> a = torch.tensor([[-0.8166, -1.3802, -0.3560]]) >>> torch.var_mean(a, unbiased=False) (tensor(0.1754), tensor(-0.8509))