Spec-Zone.ru › PyTorch 1

torch.var

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

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

Parameters:
  • input (Tensor) – the input tensor.
  • dim (int or tuple of ints, optional) – the dimension or dimensions to reduce. If None, all dimensions are reduced.
Keyword Arguments:
  • unbiased (bool) – whether to use Bessel’s correction (δN=1\delta N = 1).
  • keepdim (bool) – whether the output tensor has dim retained or not.
  • out (Tensor, optional) – the output tensor.
torch.var(input, unbiased) → Tensor

Calculates the variance 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 (δN=1\delta N = 1).

Example:

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

© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/1.13/generated/torch.var.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API