是tensorflow.train.threading.Thread不再支持?

时间:2016-12-09 14:02:30

标签: multithreading tensorflow

我正在使用来自https://github.com/Russell91/TensorBox的代码但是它无法使用GPU运行,这里是运行的结果

TensorBox$ python train.py --hypes hypes/overfeat_rezoom.json --gpu 0 --logdir output
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcufft.so 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 locally
I tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 0 with properties:
name: Quadro M4000
major: 5 minor: 2 memoryClockRate (GHz) 0.7725
pciBusID 0000:02:00.0
Total memory: 7.93GiB
Free memory: 7.63GiB
I tensorflow/core/common_runtime/gpu/gpu_device.cc:906] DMA: 0
I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 0:   Y
I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Quadro M4000, pci bus id: 0000:02:00.0)
Traceback (most recent call last):
  File "train.py", line 537, in <module>
    main()
  File "train.py", line 534, in main
    train(H, test_images=[])
  File "train.py", line 457, in train
    t = tf.train.threading.Thread(target=thread_loop,
AttributeError: 'module' object has no attribute 'threading'

tensorflow是否改变了处理线程的方式?否则,我做错了什么?

1 个答案:

答案 0 :(得分:1)

TL; DR:将其更改为threading.Thread

导入tensorflow.train.threading.Thread从来都不是正式 API的一部分,而是可以访问的,因为我们对通过TensorFlow模块可见的符号并不谨慎。当我们向稳定版本发展时,我们通过使用像Python __all__这样的技术来定义模块的精确内容,从而打压这些未记录的内容。