fn
std
→Tensorstd(x: Tensor, dim: _int | list[_int] | None = None, keepdim: _bool = False, correction: _int = 1)Compute the sample standard deviation along dim.
Defined as the square root of the (corrected) sample variance. The
correction keyword selects between Bessel-corrected (correction=1,
the default — divides by ) and biased (correction=0 —
divides by ) estimates.
Parameters
xTensorInput tensor.
dimint or list of int= NoneDimension(s) to reduce.
keepdimbool= FalseWhether to retain reduced dims with size 1.
correctionint= 1Degrees-of-freedom correction.
1 for unbiased, 0 for biased.Returns
TensorReduced floating-point tensor.
Notes
where is the correction and is the sample mean.
Examples
>>> import lucid
>>> x = lucid.tensor([1.0, 2.0, 3.0, 4.0])
>>> lucid.std(x)
Tensor(1.2910)