What do the options in ConfigProto like allow_soft_placement and log_device_placement mean?

Viewed 34895

We see this quite often in many of the TensorFlow tutorials:

sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True, 
                                        log_device_placement=True))

What does allow_soft_placement and log_device_placement mean?

4 Answers

allow_soft_placement

This option allows resilient device assignment, but it only works when your tensorflow is not GPU compiled. If your tensorflow is GPU supported the operations always perform on GPU no matter if allow_soft_placement is set or not and even if you set device as CPU. But if you set it as false and device as GPU but GPU cannot be found in your machine it raises error.

log_device_placement

This config tells you which device the operation is allocated while building the graph. It can always find the prioritized device with best performance on you machine. It seems just to ignore your settings.

In simple words:

allow_soft_placement allows dynamic allocation of GPU memory,

log_device_placement prints out device information

Related