tf.dtypes.as_dtype
Converts the given type_value
to a tf.DType
.
View aliases
Main aliases
tf.as_dtype
Compat aliases for migration
See
Migration guide for
more details.
tf.compat.v1.as_dtype
, tf.compat.v1.dtypes.as_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 .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.
[null,null,["Last updated 2024-04-26 UTC."],[],[]]