tf.dtypes.cast
import tensorflow as tf
x = tf.constant([1.8, 2.2], dtype=tf.float32)
c=tf.dtypes.cast(x, tf.int32)
print(tf.keras.backend.eval(c))
import tensorflow as tf
x = tf.constant([1.8, 2.2], dtype=tf.float32)
c=tf.dtypes.cast(x, tf.int32)
print(tf.keras.backend.eval(c))