Return (std, mean) along dim in a single call.
Fused convenience over lucid.std + lucid.mean — the
engine reduction still scans input twice, but the call site is
shorter and the two outputs share an explicit correction /
keepdim contract.
Parameters
inputTensorInput.
dimint, sequence of int, or NoneAxis or axes to reduce.
None (default) reduces over every
axis to a scalar pair. A bool here is unbiased:
std_mean(x, False).unbiasedboolTrue is correction=1, False correction=0. A
number in this place is the correction itself, as
std_mean(x, dim, 0) has always been read.keepdimboolRetain the reduced axes as size-1 dimensions. Default
False.correctionint or floatBessel correction, as
lucid.std takes it. 1 is the
unbiased sample std (default); 0 the population std.Returns
tuple of Tensor(std, mean) — same shape relationship as
lucid.std / lucid.mean would produce
individually.
Notes
correction and keepdim apply with dim=None too; they used
to be dropped there. Too few elements — no more than correction
— give nan or inf, as lucid.var explains.
Examples
>>> import lucid
>>> lucid.std_mean(lucid.tensor([1.0, 2.0, 3.0, 4.0]), correction=0)
(tensor(1.118), tensor(2.5))See Also
var_mean—variance + mean variant.