Skip to main content

Mojo function

mean

mean(src: LayoutTensor[src.dtype, src.layout, src.origin, 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:

  • src (LayoutTensor): The buffer of elements for which the mean is computed.

Returns:

Scalar: The mean value of the elements in the given buffer.

Raises:

May raise on GPU targets when a device error occurs.

mean[reduce_axis: Int](src: LayoutTensor[src.dtype, src.layout, src.origin, 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, dst.layout, dst.origin, 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.

mean(src: TileTensor[src.dtype, src.LayoutType, src.origin, address_space=src.address_space, linear_idx_type=src.linear_idx_type, element_shape_types=src.element_shape_types]) -> Scalar[src.dtype]

Computes the mean value of the elements in a buffer.

Args:

  • src (TileTensor): The buffer of elements for which the mean is computed.

Returns:

Scalar: 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?