std(input: Tensor, dim: _int | Sequence[_int] | None = None, unbiased: _bool | None = None, keepdim: _bool = False, correction: _int | _float | None = None)Implementing kernel
C++ engine symbols that back this Python API.Compute the standard deviation along dim.
The square root of var with the same arguments: correction=1
(the default) divides by , correction=0 by .
Parameters
inputTensorInput tensor.
dimint or sequence of int= NoneDimension(s) to reduce.
None reduces every element. A
dimension named twice is refused.unbiasedbool= NoneTrue is correction=1, False correction=0; it
overrides correction when given. A bool in the place of
dim — std(x, False) — is read as this.keepdimbool= FalseWhether to retain reduced dims with size 1.
correctionint or float= NoneDegrees-of-freedom correction. Default
1.Returns
TensorReduced floating-point tensor.
Raises
ValueErrorIf
dim names one dimension twice.Notes
The gradient of a slice with no spread (std 0) is 0, the
subgradient the reference picks, rather than nan. Too few elements
() give nan or inf, as var explains.
Examples
>>> import lucid
>>> x = lucid.tensor([1.0, 2.0, 3.0, 4.0])
>>> lucid.std(x)
tensor(1.291)
>>> lucid.std(x, correction=0)
tensor(1.118)