Converts the given type_value
to a tf.DType
.
tf.dtypes.as_dtype(
type_value
)
Inputs can be existing tf.DType
objects, a DataType
enum,
a string type name, or a
numpy.dtype
.
Examples:
tf.as_dtype(2) # Enum value for float64.
tf.float64
tf.as_dtype('float')
tf.float32
tf.as_dtype(np.int32)
tf.int32
Args |
type_value
|
A value that can be converted to a tf.DType object.
|
Returns |
A DType corresponding to type_value .
|
Raises |
TypeError
|
If type_value cannot be converted to a DType .
|