[[["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 2024-04-26 UTC."],[],[],null,["# tf.dtypes.as_dtype\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/framework/dtypes.py#L793-L853) |\n\nConverts the given `type_value` to a [`tf.DType`](../../tf/dtypes/DType).\n\n#### View aliases\n\n\n**Main aliases**\n\n[`tf.as_dtype`](https://www.tensorflow.org/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`](https://www.tensorflow.org/api_docs/python/tf/dtypes/as_dtype), [`tf.compat.v1.dtypes.as_dtype`](https://www.tensorflow.org/api_docs/python/tf/dtypes/as_dtype)\n\n\u003cbr /\u003e\n\n tf.dtypes.as_dtype(\n type_value\n )\n\nInputs can be existing [`tf.DType`](../../tf/dtypes/DType) objects, a [`DataType`\nenum](https://www.tensorflow.org/code/tensorflow/core/framework/types.proto),\na string type name, or a\n[`numpy.dtype`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.html).\n\n#### Examples:\n\n tf.as_dtype(2) # Enum value for float64.\n tf.float64\n\n tf.as_dtype('float')\n tf.float32\n\n tf.as_dtype(np.int32)\n tf.int32\n\n| **Note:** `DType` values are interned (i.e. a single instance of each dtype is stored in a map). When passed a new `DType` object, `as_dtype` always returns the interned value.\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. |\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"]]