Skip to content
fn

is_half_float

→bool
bool is_half_float(Dtype dt)

Predicate: is the dtype one of the two 16-bit float formats?

A property of the dtype, so it lives beside is_floating_point rather than in any one backend. Accelerate has kernels for neither format, so both take the same widen-reuse-narrow route through float32 across the CPU backend — and the random generators, which have no input to widen, use it to decide to draw wide and round.

Parameters

dtDtype
The dtype to test.

Returns

bool

true for F16 and BF16, false otherwise.