How can I view the default configuration options of a TensorFlow session?
I am aware that I can pass configuration options through the config
parameter when initializing a session, e.g.:
# Launch the graph in a session that allows soft device placement and
# logs the placement decisions.
sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True,
log_device_placement=True))
But I don't know how to view the default configuration options. tensorflow/core/protobuf/config.proto
doesn't look like the default options.
Tensorflow 1.0.0 from
pip install tensorflow-gpu
I ran:
import tensorflow as tf
import pprint
p = tf.ConfigProto()
pprint.pprint({ k:str(getattr(p,k)) for k in sorted(dir(p)) if not k.startswith('_')})
generates:
{'ALLOW_SOFT_PLACEMENT_FIELD_NUMBER': '7',
'ByteSize': '<bound method ConfigProto.ByteSize of >',
'Clear': '<bound method ConfigProto._Clear of >',
'ClearExtension': '<bound method ConfigProto.ClearExtension of >',
'ClearField': '<bound method ConfigProto.ClearField of >',
'CopyFrom': '<bound method ConfigProto.CopyFrom of >',
'DESCRIPTOR': '<google.protobuf.descriptor.Descriptor object at 0x113dbf4d0>',
'DEVICE_COUNT_FIELD_NUMBER': '1',
'DEVICE_FILTERS_FIELD_NUMBER': '4',
'DeviceCountEntry': "<class 'tensorflow.core.protobuf.config_pb2.DeviceCountEntry'>",
'DiscardUnknownFields': '<bound method ConfigProto._DiscardUnknownFields of >',
'FindInitializationErrors': '<bound method ConfigProto.FindInitializationErrors of >',
'FromString': '<function FromString at 0x113de2578>',
'GPU_OPTIONS_FIELD_NUMBER': '6',
'GRAPH_OPTIONS_FIELD_NUMBER': '10',
'HasExtension': '<bound method ConfigProto.HasExtension of >',
'HasField': '<bound method ConfigProto.HasField of >',
'INTER_OP_PARALLELISM_THREADS_FIELD_NUMBER': '5',
'INTRA_OP_PARALLELISM_THREADS_FIELD_NUMBER': '2',
'IsInitialized': '<bound method ConfigProto.IsInitialized of >',
'LOG_DEVICE_PLACEMENT_FIELD_NUMBER': '8',
'ListFields': '<bound method ConfigProto.ListFields of >',
'MergeFrom': '<bound method ConfigProto.MergeFrom of >',
'MergeFromString': '<bound method ConfigProto.MergeFromString of >',
'OPERATION_TIMEOUT_IN_MS_FIELD_NUMBER': '11',
'PLACEMENT_PERIOD_FIELD_NUMBER': '3',
'ParseFromString': '<bound method ConfigProto.ParseFromString of >',
'RPC_OPTIONS_FIELD_NUMBER': '13',
'RegisterExtension': '<function RegisterExtension at 0x113de2500>',
'SESSION_INTER_OP_THREAD_POOL_FIELD_NUMBER': '12',
'SerializePartialToString': '<bound method ConfigProto.SerializePartialToString of >',
'SerializeToString': '<bound method ConfigProto.SerializeToString of >',
'SetInParent': '<bound method ConfigProto.Modified of >',
'USE_PER_SESSION_THREADS_FIELD_NUMBER': '9',
'WhichOneof': '<bound method ConfigProto.WhichOneof of >',
'allow_soft_placement': 'False',
'device_count': '{}',
'device_filters': '[]',
'gpu_options': '',
'graph_options': '',
'inter_op_parallelism_threads': '0',
'intra_op_parallelism_threads': '0',
'log_device_placement': 'False',
'operation_timeout_in_ms': '0',
'placement_period': '0',
'rpc_options': '',
'session_inter_op_thread_pool': '[]',
'use_per_session_threads': 'False'}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With