Python for循环中的GPU

Python for循环中的GPU,python,keras,gpu,Python,Keras,Gpu,我试图在一个涉及神经网络的函数上做一个for循环。nn\u f是一个训练神经网络的函数,Keras的后端设置为GPU: import os os.environ["KERAS_BACKEND"] = "plaidml.keras.backend" # was #Tensorflow os.environ["PLAIDML_EXPERIMENTAL"] = "1" # i.e. y/n question in terminal : "1" represent yes os.environ["

我试图在一个涉及神经网络的函数上做一个for循环。
nn\u f
是一个训练神经网络的函数,Keras的后端设置为GPU:

import os 
os.environ["KERAS_BACKEND"] = "plaidml.keras.backend" # was #Tensorflow
os.environ["PLAIDML_EXPERIMENTAL"] = "1"  # i.e. y/n question in terminal : "1" represent yes 
os.environ["PLAIDML_DEVICE_IDS"] = "opencl_amd_gfx1010.0"
运行单个
nn\u f
足够快

然而,我发现循环的速度比预期的要慢得多,我想知道如何加速整个过程

func = partial(nn_f,batch_size, epochs ...)
R_2_l = [ ]
for x, y in zip(param_l[0], param_l[1]):

           R_2_l.append(func(x,y))