This name was deprecated and removed in TF2, but has an exact replacement
tf.cast(..., tf.int32). There are no further issues with eager execution or
tf.function.
[[["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.compat.v1.to_int32\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/ops/math_ops.py#L1186-L1223) |\n\nCasts a tensor to type `int32`. (deprecated) \n\n tf.compat.v1.to_int32(\n x, name='ToInt32'\n )\n\n\u003cbr /\u003e\n\nMigrate to TF2\n--------------\n\n\u003cbr /\u003e\n\n| **Caution:** This API was designed for TensorFlow v1. Continue reading for details on how to migrate from this API to a native TensorFlow v2 equivalent. See the [TensorFlow v1 to TensorFlow v2 migration guide](https://www.tensorflow.org/guide/migrate) for instructions on how to migrate the rest of your code.\n\nThis name was deprecated and removed in TF2, but has an exact replacement\n[`tf.cast(..., tf.int32)`](../../../tf/cast). There are no further issues with eager execution or\ntf.function.\n\nBefore: \n\n tf.compat.v1.to_int32(tf.constant(1, dtype=tf.int64))\n \u003ctf.Tensor: shape=(), dtype=int32, numpy=1\u003e\n\nAfter: \n\n tf.cast(tf.constant(1, dtype=tf.int64), tf.int32)\n \u003ctf.Tensor: shape=(), dtype=int32, numpy=1\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nDescription\n-----------\n\n### Used in the notebooks\n\n| Used in the tutorials |\n|---------------------------------------------------------------------------------------------------------------------------------|\n| - [Linear Mixed-Effect Regression in {TF Probability, R, Stan}](https://www.tensorflow.org/probability/examples/HLM_TFP_R_Stan) |\n\n| **Deprecated:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use [`tf.cast`](../../../tf/cast) instead.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------|--------------------------------------------------|\n| `x` | A `Tensor` or `SparseTensor` or `IndexedSlices`. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor` or `SparseTensor` or `IndexedSlices` with same shape as `x` with type `int32`. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|-------------|---------------------------------------|\n| `TypeError` | If `x` cannot be cast to the `int32`. |\n\n\u003cbr /\u003e"]]