2

how can I manually assign more than one device to one single op in TensorFlow (python API)?

For example, in order to assign one cpu to a graph, I would do:

with tf.device("/cpu:0"):
    # Define operation here

What if I want to assign cpu 0, 1, 2, 3 all to this same op?

It seems like I can't use a list of device names as the arg for tf.device. Any help or guidance would be appreciated. Thanks!

Wei
  • 37
  • 5

1 Answers1

1

You can have multiple with contexts like so:

with tf.device("/cpu:0") as cpu0, tf.device("/cpu:1") as cpu1:
    pass
darksky
  • 1,955
  • 16
  • 28