【Tensorflow】tf.cast 类型转换 函数

来源:互联网 发布:儿童防沉迷软件 ipad 编辑:程序博客网 时间:2024/06/05 21:06

tf.cast(x, dtype, name=None)

此函数是类型转换函数

参数
  • x:输入
  • dtype:转换目标类型
  • name:名称
返回:Tensor

例:
# tensor `a` is [1.8, 2.2], dtype=tf.floattf.cast(a, tf.int32) ==> [1, 2]  # dtype=tf.int32


1 0