return tf.get_default_session()
if _SESSION is None:
if not os.environ.get("OMP_NUM_THREADS"):
_SESSION = tf.Session(config=tf.ConfigProto(allow_soft_placement=True))
else:
nb_thread = int(os.environ.get("OMP_NUM_THREADS"))
_SESSION = tf.Session(config=tf.ConfigProto(intra_op_parallelism_threads=nb_thread,
After Change
else:
if _SESSION is None:
if not os.environ.get("OMP_NUM_THREADS"):
config = tf.ConfigProto(allow_soft_placement=True)
else:
nb_thread = int(os.environ.get("OMP_NUM_THREADS"))
config = tf.ConfigProto(intra_op_parallelism_threads=nb_thread,
allow_soft_placement=True)
_SESSION = tf.Session(config=config)
session = _SESSION
if not _MANUAL_VAR_INIT:
_initialize_variables()
return session