如何在TensorFlow (python API)中手动将多个设备分配给单个op?
例如,为了将一个cpu分配给一个图,我会这样做:
with tf.device("/cpu:0"):
# Define operation here
如果我想将cpu 0、1、2、3全部分配给这个相同的操作,该怎么办?
似乎我不能使用设备名称列表作为tf.device的参数。任何帮助或指导都将不胜感激。谢谢!
发布于 2017-08-05 08:29:30
你可以像这样拥有multiple with
contexts:
with tf.device("/cpu:0") as cpu0, tf.device("/cpu:1") as cpu1:
pass
https://stackoverflow.com/questions/45517081
复制相似问题