使用GPU训练 使用GPU进行训练 CPU:fluid.CPUPlace() GPU: fluid.CUDAPlace(0),四个GPU卡的编号0,1,2,3 #仅前3行代码有所变化,在使用GPU时,可以将use_gpu变量设置成True use_gpu = False place = fluid.CUDAPlace(0) if use_gpu else fluid.CPUPlace() with fluid.dygraph.guard(place): #用place作为资源进行训练 model = MNIST() model.