tensorflow.cast()类型转换函数
tf.cast(x, dtype, name=None)
此函数是类型转换函数
参数
x:输入
dtype:转换目标类型
name:名称
返回:Tensor
例:
# tensor `a` is [1.8, 2.2], dtype=tf.float
tf.cast(a, tf.int32) ==> [1, 2] # dtype=tf.int32
本文介绍了 TensorFlow 中的类型转换函数 tf.cast 的使用方法。该函数可以将输入张量的数据类型转换为目标类型,并通过示例展示了如何将浮点数张量转换为整数张量。
4707

被折叠的 条评论
为什么被折叠?



