美文网首页
在keras上使用gpu的方法

在keras上使用gpu的方法

作者: 149061582475 | 来源:发表于2019-03-04 20:40 被阅读0次

    80

    Yes you can run keras models on GPU. Few things you will have to check first.

    your system has GPU (Nvidia. As AMD doesn't work yet)

    You have installed the GPU version of tensorflow 

    You have installed CUDA installation instructions

    Verify that tensorflow is running with GPU check if GPU is working

    sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))

    OR

    from tensorflow.python.client import device_libprint(device_lib.list_local_devices())

    output will be something like this:

    [  name: "/cpu:0"device_type: "CPU",  name: "/gpu:0"device_type: "GPU"]

    Once all this is done your model will run on GPU:

    To Check if keras(>=2.1.1) is using GPU:

    from keras import backend as K

    K.tensorflow_backend._get_available_gpus()

    All the best.

    相关文章

      网友评论

          本文标题:在keras上使用gpu的方法

          本文链接:https://www.haomeiwen.com/subject/giswuqtx.html