Skip to content
fn

std_op

→TensorImplPtr
int std_op(const int & a, const int & axes, bool keepdims)

Python wrappers

Public Python APIs implemented by this engine symbol.

Compute the (biased) standard deviation along axes.

Defined as std(x)=var(x,axes,keepdims)\mathrm{std}(x) = \sqrt{\mathrm{var}(x, \text{axes}, \text{keepdims})}, where the underlying variance uses the biased estimator 1N∑(x−xˉ)2\frac{1}{N}\sum (x - \bar{x})^2. No new backward node is needed: the gradient flows naturally through SqrtBackward and VarBackward via the chain rule.

Math

std(x)=1N∑i∈axes(xi−xˉ)2. \mathrm{std}(x) = \sqrt{\frac{1}{N}\sum_{i \in \text{axes}} (x_i - \bar{x})^2}.

See Also

var_op — variance the standard deviation is built on.

Parameters

aTensorImplPtr
Input tensor of float dtype.
axesstd::vector<int>
Axes to reduce. Negative indices wrap.
keepdimsbool
If true, retains reduced dims as size-1.

Returns

TensorImplPtr

Output tensor of the reduced shape.