For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).
variance
variance(src: LayoutTensor[address_space=src.address_space, element_layout=src.element_layout, layout_int_type=src.layout_int_type, linear_idx_type=src.linear_idx_type, masked=src.masked, alignment=src.alignment], correction: Int = 1) -> Scalar[src.dtype]
Computes the variance value of the elements in a buffer.
variance(x) = sum((x - E(x))^2) / (size - correction)
Args:
- src (
LayoutTensor[address_space=src.address_space, element_layout=src.element_layout, layout_int_type=src.layout_int_type, linear_idx_type=src.linear_idx_type, masked=src.masked, alignment=src.alignment]): The buffer. - correction (
Int): Normalize variance by size - correction (Default=1).
Returns:
Scalar[src.dtype]: The variance value of the elements in a buffer.
Raises:
May raise on GPU targets when a device error occurs.
variance(src: TileTensor[address_space=src.address_space, linear_idx_type=src.linear_idx_type, element_size=src.element_size], correction: Int = 1) -> Scalar[src.dtype]
Computes the variance value of the elements in a buffer.
variance(x) = sum((x - E(x))^2) / (size - correction)
Args:
- src (
TileTensor[address_space=src.address_space, linear_idx_type=src.linear_idx_type, element_size=src.element_size]): The buffer. - correction (
Int): Normalize variance by size - correction (Default=1).
Returns:
Scalar[src.dtype]: The variance value of the elements in a buffer.
Raises:
May raise on GPU targets when a device error occurs.