转换int和float类型

在代码期间,会发现,tensorflow是float类型,而scipy.imread为int类型,则需要强制转换类型,这里有两种方法

(1)numpy.asarry(dtype)

(2)tf.image.convert_image_dtype(dtype)

(3)tf.cast(image, tf.float32)

(4)tf.to_float(tensor)

猜你喜欢

转载自blog.csdn.net/xuan_zizizi/article/details/79059757
今日推荐