tf.dtypes.as_dtype
bookmark_borderbookmark
Stay organized with collections
Save and categorize content based on your preferences.
Converts the given type_value
to a 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
)
Args |
type_value
|
A value that can be converted to a tf.DType object. This may
currently be a tf.DType object, a DataType
enum,
a string type name, or a numpy.dtype .
|
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.
Last updated 2020-10-01 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2020-10-01 UTC."],[],[],null,["# tf.dtypes.as_dtype\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 1 version](/versions/r1.15/api_docs/python/tf/dtypes/as_dtype) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/python/framework/dtypes.py#L690-L721) |\n\nConverts the given `type_value` to a `DType`.\n\n#### View aliases\n\n\n**Main aliases**\n\n[`tf.as_dtype`](/api_docs/python/tf/dtypes/as_dtype)\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.as_dtype`](/api_docs/python/tf/dtypes/as_dtype), [`tf.compat.v1.dtypes.as_dtype`](/api_docs/python/tf/dtypes/as_dtype)\n\n\u003cbr /\u003e\n\n tf.dtypes.as_dtype(\n type_value\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `type_value` | A value that can be converted to a [`tf.DType`](../../tf/dtypes/DType) object. This may currently be a [`tf.DType`](../../tf/dtypes/DType) object, a [`DataType` enum](https://www.tensorflow.org/code/tensorflow/core/framework/types.proto), a string type name, or a `numpy.dtype`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `DType` corresponding to `type_value`. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|-------------|---------------------------------------------------|\n| `TypeError` | If `type_value` cannot be converted to a `DType`. |\n\n\u003cbr /\u003e"]]