我在Python 3.5中使用TensorFlow 1.12.0。当我调用tf.io.decode_jpg()
(或tf.io
中的任何函数)时,出现以下错误:AttributeError: module 'tensorflow._api.v1.io' has no attribute 'decode_***'
。
我按如下所示导入TensorFlow:
import tensorflow as tf
我还尝试了直接导入io
模块,但无济于事。我将函数调用如下:
rgb = tf.io.decode_image(tf.read_file(DIR_DATASET + sample_name + ".jpg"))