在GPU上运行的TFLearn设置仍在CPU上计算?

时间:2018-06-06 16:20:08

标签: image tensorflow gpu cpu tflearn

所以我使用alexnet.py模型设置使用我的GPU,但它只使用CPU,尝试添加init_graph函数,但它仍然只在CPU上执行。是的我有cuda和cudnn安装了tensorflow-gpu。

X, Y = image_preloader('./newtrain/', image_shape = (227, 227), mode = 'folder')

# Building 'AlexNet'
network=...
...

tflearn.init_graph(num_cores=4,gpu_memory_fraction=0.5)
with tf.device("/device:GPU:0"):
    # Training
    model = tflearn.DNN(network, checkpoint_path='./model_alexnet',
                        max_checkpoints=1, tensorboard_verbose=2)
    model.fit(X, Y, n_epoch=30, validation_set=0.1, shuffle=True,
              show_metric=True, batch_size=64, snapshot_step=200,
              snapshot_epoch=False, run_id='alexnet_classify')

0 个答案:

没有答案