Skip to main content
Log in

Mojo function

get_accum_type

get_accum_type[type: DType]() -> DType

Returns the recommended type for accumulation operations.

Half precision types can introduce numerical error if they are used in reduction/accumulation operations. This method returns a higher precision type to use for accumulation if a half precision types is provided, otherwise it returns the original type.

Parameters:

  • type (DType): The type of some accumulation operation.

Returns:

DType.float32 if type is a half-precision float, type otherwise.