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

mean

def mean(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]) -> Scalar[src.dtype]

Computes the mean value of the elements in a buffer.

Args:

Returns:

Scalar[src.dtype]: The mean value of the elements in the given buffer.

Raises:

May raise on GPU targets when a device error occurs.

def mean[reduce_axis: Int](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], dst: LayoutTensor[src.dtype, address_space=dst.address_space, element_layout=dst.element_layout, layout_int_type=dst.layout_int_type, linear_idx_type=dst.linear_idx_type, masked=dst.masked, alignment=dst.alignment])

Computes the mean across reduce_axis of a LayoutTensor.

Parameters:

  • ​reduce_axis (Int): The axis to reduce across.

Args:

Raises:

May raise on GPU targets when a device error occurs.

def mean(src: TileTensor[Storage=src.Storage, address_space=src.address_space, linear_idx_type=src.linear_idx_type]) -> Scalar[src.dtype]

Computes the mean value of the elements in a buffer.

Args:

Returns:

Scalar[src.dtype]: The mean value of the elements in the given buffer.

Raises:

May raise on GPU targets when a device error occurs.

Was this page helpful?