TensorFlow 张量变换

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/qq_36825778/article/details/102768589

TensorFlow 张量变换

TensorFlow提供以下几种张量数据类型变换函数

  • tf.string_to_number
  • tf.to_double
  • tf.to_float
  • tf.to_bfloat16
  • tf.to_int32
  • tf.to_int64
  • tf.cast
  • tf.bitcast
  • tf.saturate_cast

说明:

tf.to_float(
    x,
    name='ToFloat'
)
  • 以tf.to_float为例,输入的x是tensor,所以一般需要通过tf.convert_to_tensor将python对象转化为tensor作为输入
  • 返回的结果是类型对应函数名的tensor

猜你喜欢

转载自blog.csdn.net/qq_36825778/article/details/102768589