怎么把tf.int64转换成tf.float32? [英] How to convert tf.int64 to tf.float32?

查看:1173
本文介绍了怎么把tf.int64转换成tf.float32?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试过:

test_image = tf.convert_to_tensor(img, dtype=tf.float32)

然后出现以下错误:

ValueError: Tensor conversion requested dtype float32 for Tensor with dtype int64: 'Tensor("test/ArgMax:0", shape=TensorShape([Dimension(None)]), dtype=int64)'

推荐答案

糟糕,我在API中找到了该函数...

Oops, I find the function in the API...

 tf.to_float(x, name='ToFloat')

这篇关于怎么把tf.int64转换成tf.float32?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆