fn
var
→Tensorvar(x: Tensor, dim: _int | list[_int] | None = None, keepdim: _bool = False, correction: _int = 1)Compute the sample variance along dim.
Computes the mean squared deviation from the per-slice mean. Selecting
correction=1 (default) yields Bessel's unbiased estimator;
correction=0 produces the maximum-likelihood (biased) estimator.
Parameters
xTensorInput tensor.
dimint or list of int= NoneDimension(s) to reduce.
keepdimbool= FalseRetain reduced dims with size 1.
correctionint= 1Degrees-of-freedom correction.
Returns
TensorReduced floating-point tensor.
Notes
with set by the correction keyword.
Examples
>>> import lucid
>>> x = lucid.tensor([1.0, 2.0, 3.0, 4.0])
>>> lucid.var(x)
Tensor(1.6667)