code: def restore_tf_graph(sess, fpath):
      """
      Loads graphs saved by Logger.
  
      Will output a dictionary whose keys and values are from the 'inputs'
      and 'outputs' dict you specified with logger.setup_tf_saver().
  
      Args:
          sess: A Tensorflow session.
          fpath: Filepath to save directory.
  
      Returns:
          A dictionary mapping from keys to tensors in the computation graph
          loaded from ``fpath``.
      """
      tf.saved_model.loader.load(
          sess, [tf.saved_model.tag_constants.SERVING], fpath
      )
      model_info = joblib.load(osp.join(fpath, "model_info.pkl"))
      graph = tf.get_default_graph()
      model = dict()
      model.update(
          {
              k: graph.get_tensor_by_name(v)
              for k, v in model_info["inputs"].items()
          }
      )
      model.update(
          {
              k: graph.get_tensor_by_name(v)
              for k, v in model_info["outputs"].items()
          }
      )
      return model
  
imports: import json
  import joblib
  import shutil
  import numpy
  import tensorflow
  import torch
  import os.path, time, atexit, os
  import warnings
  from spinup.utils.mpi_tools import proc_id, mpi_statistics_scalar
  from spinup.utils.serialization_utils import convert_json
label_desc: Use image node_id 2 for calling a global function with example usage: restore_tf_graph(sess, fpath) and returns: model