baselines/common/tf_util.py
def make_session(config=None, num_cpu=None, make_default=False, graph=None):
    """Returns a session that will use <num_cpu> CPU's only"""
    if num_cpu is None:
        num_cpu = int(os.getenv('RCALL_NUM_CPU', multiprocessing.cpu_count()))
    if config is None:
        config = tf.ConfigProto(
            allow_soft_placement=True,
            inter_op_parallelism_threads=num_cpu,
            intra_op_parallelism_threads=num_cpu)
        config.gpu_options.allow_growth = True

    if make_default:
        return tf.InteractiveSession(config=config, graph=graph)
    else:
        return tf.Session(config=config, graph=graph)
def make_session(config=None, num_cpu=None, make_default=False, graph=None):
    """Returns a session that will use <num_cpu> CPU's only"""
    if num_cpu is None:
        num_cpu = int(os.getenv('RCALL_NUM_CPU', multiprocessing.cpu_count()))
    if config is None:
        config = tf.ConfigProto(
            allow_soft_placement=True,
            inter_op_parallelism_threads=num_cpu,
            intra_op_parallelism_threads=num_cpu)
        config.gpu_options.allow_growth = True

    if make_default:
        return tf.InteractiveSession(config=config, graph=graph)
    else:
        return tf.Session(config=config, graph=graph)
def make_session ( config = None , num_cpu = None , make_default = False , graph = None ) : if num_cpu is None : num_cpu = int ( os . getenv ( 'RCALL_NUM_CPU' , multiprocessing . cpu_count ( ) ) ) if config is None : config = tf . ConfigProto ( allow_soft_placement = True , inter_op_parallelism_threads = num_cpu , intra_op_parallelism_threads = num_cpu ) config . gpu_options . allow_growth = True if make_default : return tf . InteractiveSession ( config = config , graph = graph ) else : return tf . Session ( config = config , graph = graph )
Returns a session that will use <num_cpu> CPU's only
Returns a session that will use <num_cpu > CPU s only