Python 在tensorflow上运行cifar10时,会出现AttributeError:no attribute';随机作物';

Python 在tensorflow上运行cifar10时,会出现AttributeError:no attribute';随机作物';,python,tensorflow,Python,Tensorflow,我使用tensorflow从internet下载cifar10代码,当我运行cifar10\u train.py时,出现以下错误: ubuntu@ip-172-31-58-100:~$ python cifar10_train.py I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcublas.so.7.5 locally I tensorflow/stream_executo

我使用tensorflow从internet下载cifar10代码,当我运行
cifar10\u train.py
时,出现以下错误:

ubuntu@ip-172-31-58-100:~$ python cifar10_train.py
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcublas.so.7.5 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcufft.so.7.5 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcurand.so.7.5 locally
Traceback (most recent call last):
  File "cifar10_train.py", line 142, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 43, in run
    sys.exit(main(sys.argv[:1] + flags_passthrough))
  File "cifar10_train.py", line 137, in main
    train()
  File "cifar10_train.py", line 68, in train
    images, labels = cifar10.distorted_inputs()  
  File "/home/ubuntu/cifar10.py", line 121, in distorted_inputs
    batch_size=FLAGS.batch_size)
  File "/home/ubuntu/cifar10_input.py", line 130, in distorted_inputs
    distorted_image = tf.image.random_crop(reshaped_image, [height, width])
AttributeError: 'module' object has no attribute 'random_crop'
ubuntu@ip-172-31-58-100:~$python cifar10\u train.py
I tensorflow/stream_executor/dso_loader.cc:128]在本地成功打开了CUDA库libcublas.so.7.5
I tensorflow/stream_executor/dso_loader.cc:128]在本地成功打开了CUDA库libcudnn.so.5
I tensorflow/stream_executor/dso_loader.cc:128]在本地成功打开了CUDA库libcuft.so.7.5
I tensorflow/stream_executor/dso_loader.cc:128]在本地成功打开了CUDA库libcuda.so.1
I tensorflow/stream_executor/dso_loader.cc:128]在本地成功打开了CUDA库libcurand.so.7.5
回溯(最近一次呼叫最后一次):
文件“cifar10_train.py”,第142行,在
tf.app.run()
文件“/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py”,第43行,正在运行
系统出口(主(系统argv[:1]+标志通过))
文件“cifar10_train.py”,第137行,主目录
列车()
列车中第68行的文件“cifar10_train.py”
图像、标签=cifar10.扭曲的_输入()
文件“/home/ubuntu/cifar10.py”,第121行,输入失真
批次大小=标志。批次大小)
文件“/home/ubuntu/cifar10_input.py”,第130行,扭曲的_输入
扭曲的图像=tf.image.random\u裁剪(重塑的图像,[高度,宽度])
AttributeError:“模块”对象没有属性“随机裁剪”

有人知道发生了什么吗?非常感谢

此代码可能来自tensorflow的旧版本,而不是您安装的版本

试着换线

tf.image.random_crop(reshaped_image, [height, width])

tf.random_crop(reshaped_image, [height, width])