IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo function

variance

def 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 = 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:

Returns:

Scalar[src.dtype]: The variance value of the elements in a buffer.

Raises:

May raise on GPU targets when a device error occurs.

def variance(src: TileTensor[Storage=src.Storage, address_space=src.address_space, linear_idx_type=src.linear_idx_type], correction: Int = 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:

Returns:

Scalar[src.dtype]: The variance value of the elements in a buffer.

Raises:

May raise on GPU targets when a device error occurs.

Was this page helpful?