检查keras/tensorflow是否正常调用GPU代码
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
    os.environ['CUDA_VISIBLE_DEVICES'] = "0"
    a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
    b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
    c = tf.matmul(a, b)
    # Creates a session with log_device_placement set to True.
    sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
    # Runs the op.
    print(sess.run(c))
    # print(device_lib.list_local_devices())

 


 
                    
            
                

相关文章:

  • 2021-10-28
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
  • 2021-08-16
  • 2022-12-23
  • 2021-10-20
  • 2022-12-23
猜你喜欢
  • 2021-11-12
  • 2021-10-26
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案