# torch.std¶

torch.std(input, dim, unbiased, keepdim=False, *, out=None) → Tensor

If unbiased is True, Bessel’s correction will be used. Otherwise, the sample deviation is calculated, without any correction.

Parameters
• input (Tensor) – the input tensor.

• dim (int or tuple of python:ints) – the dimension or dimensions to reduce.

Keyword Arguments
• unbiased (bool) – whether to use Bessel’s correction ($\delta N = 1$).

• keepdim (bool) – whether the output tensor has dim retained or not.

• out (Tensor, optional) – the output tensor.

torch.std(input, unbiased) → Tensor

Calculates the standard deviation of all elements in the input tensor.

If unbiased is True, Bessel’s correction will be used. Otherwise, the sample deviation is calculated, without any correction.

Parameters
• input (Tensor) – the input tensor.

• unbiased (bool) – whether to use Bessel’s correction ($\delta N = 1$).

Example:

>>> a = torch.tensor([[-0.8166, -1.3802, -0.3560]])
>>> torch.std(a, unbiased=False)
tensor(0.4188)