Skip to contents

Coerces a value to a TensorDataType. Accepts data type strings (e.g. "f32", "i64", "i1") or existing TensorDataType objects (they are returned unchanged).

Usage

as_dtype(x)

Arguments

x

A character string or TensorDataType to convert.

Value

A TensorDataType object.

Details

This is implemented via the generic stablehlo::as_dtype().

Examples

as_dtype("f32")
#> <f32>
as_dtype("i32")
#> <i32>