Tensorflow 支援使用 CPU 和 GPU 做運算

  • "/cpu:0": The CPU of your machine.
  • "/gpu:0": The GPU of your machine, if you have one.
  • "/gpu:1": The second GPU of your machine, etc.

用 with tf.device() 來分配這個語句下使用的設備 TF_GPUs1 log.device_placement = True 紀錄我們使用device的情況 allow_soft_placement = True 避免指定的device不存在,讓他能自行分配到存在且可運行的地方 TF_GPUs2 我沒有多顆CPU,其他的語法先不試