code: def start_tf_sess(threads=-1, server=None):
      """
      Returns a tf.Session w/ config
      """
      config = tf.compat.v1.ConfigProto()
      config.gpu_options.allow_growth = True
      config.graph_options.rewrite_options.layout_optimizer = (
          rewriter_config_pb2.RewriterConfig.OFF
      )
      if threads > 0:
          config.intra_op_parallelism_threads = threads
          config.inter_op_parallelism_threads = threads
  
      if server is not None:
          return tf.compat.v1.Session(
              target=server.target, config=config
          )
  
      return tf.compat.v1.Session(config=config)
  
imports: import tarfile
  import os
  import json
  import requests
  import sys
  import shutil
  import re
  from tqdm import tqdm, trange
  import numpy
  import tensorflow
  from tensorflow.core.protobuf import rewriter_config_pb2
  from tensorflow.python.client import device_lib
  import time
  from datetime import datetime
  import csv
  import argparse
  from sys import exit
  import codecs
  from gpt_2_simple.src import model, sample, encoder, memory_saving_gradients
  from gpt_2_simple.src.load_dataset import load_dataset, Sampler
  from gpt_2_simple.src.accumulate import AccumulatingOptimizer
label_desc: Use image node_id 3 for calling a global function with example usage: start_tf_sess(threads, server) and returns: tf, tf