Scatter Std

torch_scatter.scatter_std(src, index, dim=-1, out=None, dim_size=None, unbiased=True)[source]

https://raw.githubusercontent.com/rusty1s/pytorch_scatter/master/docs/source/_figures/std.svg?sanitize=true

Computes the standard-deviation from all values from the src tensor into out at the indices specified in the index tensor along a given axis dim (cf. scatter_add()).

For one-dimensional tensors, the operation computes

\[\mathrm{out}_i = \sqrt{\frac{\sum_j {\left( x_j - \overline{x}_i \right)}^2}{N_i - 1}}\]

where \(\sum_j\) is over \(j\) such that \(\mathrm{index}_j = i\). \(N_i\) and \(\overline{x}_i\) indicate the number of indices referencing \(i\) and their mean value, respectively.

Parameters:
  • src (Tensor) – The source tensor.
  • index (LongTensor) – The indices of elements to scatter.
  • dim (int, optional) – The axis along which to index. (default: -1)
  • out (Tensor, optional) – The destination tensor. (default: None)
  • dim_size (int, optional) – If out is not given, automatically create output with size dim_size at dimension dim. If dim_size is not given, a minimal sized output tensor is returned. (default: None)
  • unbiased (bool, optional) – If set to False, then the standard- deviation will be calculated via the biased estimator. (default: True)
Return type:

Tensor