i have several calls tf.gradients each take time, concurrently call tf.gradients . however, receive 1 of several errors when try in graph. suspect not thread-safe, have not been able reproduce error mwe. tried using both pathos.pools.threadpool , pathos.pools.processpool in both mwe , real code - real code fails. here mwe tried: from pathos.pools import threadpool, processpool import tensorflow tf import numpy np xs = [tf.cast(np.random.random((10,10)), dtype=tf.float64) in range(3)] ys = [xs[0]*xs[1]*xs[2], xs[0]/xs[1]*xs[2], xs[0]/xs[1]/xs[2]] def compute_grad(yx): return tf.gradients(yx[0], yx[1]) tp = threadpool(3) res = tp.map(compute_grad, zip(ys, xs)) print(res) here's partial traceback encountered when trying real code. threadpool version. file "pathos/threading.py", line 134, in map return _pool.map(star(f), zip(*args)) # chunksize file "multiprocess/pool.py", line 260, in map return self._map_async(func, iterable, mapsta...