Scatter Std¶
-
torch_scatter.
scatter_std
(src, index, dim=-1, out=None, dim_size=None, unbiased=True)[source]¶ Computes the standard-deviation from all values from the
src
tensor intoout
at the indices specified in theindex
tensor along a given axisdim
(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 sizedim_size
at dimensiondim
. Ifdim_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