Mojo function
variance
variance(src: LayoutTensor[dtype, layout, origin, address_space=address_space, element_layout=element_layout, layout_int_type=layout_int_type, linear_idx_type=linear_idx_type, masked=masked, alignment=alignment], correction: Int = 1) -> Scalar[dtype]
Computes the variance value of the elements in a buffer.
variance(x) = sum((x - E(x))^2) / (size - correction)
Args:
- src (
LayoutTensor
): The buffer. - correction (
Int
): Normalize variance by size - correction (Default=1).
Returns:
Scalar
: The variance value of the elements in a buffer.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!