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

后端 未结 4 1703
攒了一身酷
攒了一身酷 2020-12-13 06:24

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

sess = tf.Session(config=tf.ConfigProto(allow_soft_placem         


        
4条回答
  •  执笔经年
    2020-12-13 07:09

    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.

提交回复
热议问题