We see this quite often in many of the TensorFlow tutorials:
sess = tf.Session(config=tf.ConfigProto(allow_soft_placem
In addition to comments in tensorflow/core/protobuf/config.proto (allow_soft_placement, log_device_placement) it is also explained in TF's using GPUs tutorial.
To find out which devices your operations and tensors are assigned to, create the session with
log_device_placement
configuration option set to True.
Which is helpful for debugging. For each of the nodes of your graph, you will see the device it was assigned to.
If you would like TensorFlow to automatically choose an existing and supported device to run the operations in case the specified one doesn't exist, you can set
allow_soft_placement
to True in the configuration option when creating the session.
Which will help you if you accidentally manually specified the wrong device or a device which does not support a particular op. This is useful if you write a code which can be executed in environments you do not know. You still can provide useful defaults, but in the case of failure a graceful fallback.