ML Community Day is November 9! Join us for updates from TensorFlow, JAX, and more Learn more


Represents the type of the elements in a Tensor.

DTypes are used to specify the output data type for operations which require it, or to inspect the data type of existing Tensors.


tf.constant(1, dtype=tf.int64)
<tf.Tensor: shape=(), dtype=int64, numpy=1>

See tf.dtypes for a complete list of DTypes defined.

as_datatype_enum Returns a types_pb2.DataType enum value based on this data type.
as_numpy_dtype Returns a Python type object based on this DType.
base_dtype Returns a non-reference DType based on this DType.
is_bool Returns whether this is a boolean data type.
is_complex Returns whether this is a complex floating point type.
is_floating Returns whether this is a (non-quantized, real) floating point type.
is_integer Returns whether this is a (non-quantized) integer type.
is_numpy_compatible Returns whether this data type has a compatible NumPy data type.
is_quantized Returns whether this is a quantized data type.
is_unsigned Returns whether this type is unsigned.

Non-numeric, unordered, and quantized types are not considered unsigned, and this function returns False.

limits Return intensity limits, i.e.

(min, max) tuple, of the dtype. Args: clip_negative : bool, optional If True, clip the negative range (i.e. return 0 for min intensity) even if the image dtype allows negative values. Returns min, max : tuple Lower and upper intensity limits.

max Returns the maximum representable value in this data type.