I have recently been working on a project that uses a neural network for virtual robot control. I used tensorflow to code it up and it runs smoothly. So far, I used sequenti
I use keras as a wrapper with tensorflow as a backed, but the same general principal should apply.
If you try something like this:
import keras
from functools import partial
from multiprocessing import Pool
def ModelFunc(i,SomeData):
YourModel = Here
return(ModelScore)
pool = Pool(processes = 4)
for i,Score in enumerate(pool.imap(partial(ModelFunc,SomeData),range(4))):
print(Score)
It will fail. However, if you try something like this:
from functools import partial
from multiprocessing import Pool
def ModelFunc(i,SomeData):
import keras
YourModel = Here
return(ModelScore)
pool = Pool(processes = 4)
for i,Score in enumerate(pool.imap(partial(ModelFunc,SomeData),range(4))):
print(Score)
It should work. Try calling tensorflow separately for each process.