docstr: Load a SavedModel into a TF 1.x-style graph and run `signature_key`.
docstr_tok: ["Load","a","SavedModel","into","a","TF","1.x-style","graph","and","run","`","signature_key","`","."]
code: def load_and_run_v1(
      self,
      model_dir,
      inputs,
      signature_key=tf1.saved_model.signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY,
  ):
      """Load a SavedModel into a TF 1.x-style graph and run `signature_key`."""
      graph = tf.Graph()
      with graph.as_default(), tf1.Session() as session:
          meta_graph_def = tf1.saved_model.load(
              session,
              [tf1.saved_model.tag_constants.SERVING],
              model_dir,
          )
          signature = meta_graph_def.signature_def[signature_key]
          feed_dict = {}
          for arg_name in inputs.keys():
              input_tensor = session.graph.get_tensor_by_name(
                  signature.inputs[arg_name].name
              )
              feed_dict[input_tensor] = inputs[arg_name]
          output_dict = {}
          for (
              output_name,
              output_tensor_info,
          ) in signature.outputs.items():
              output_dict[
                  output_name
              ] = session.graph.get_tensor_by_name(
                  output_tensor_info.name
              )
          return session.run(output_dict, feed_dict)["output_0"]
  
imports: import os
  from absl.testing import parameterized
  import tensorflow
  import tensorflow.compat.v1
  from tensorflow.python.distribute import combinations
  from tensorflow.python.distribute import multi_worker_test_base
  from tensorflow.python.distribute import parameter_server_strategy_v2
  from tensorflow.python.distribute import sharded_variable
  from tensorflow.python.distribute import strategy_combinations
  from tensorflow.python.distribute import test_util
  from tensorflow.python.distribute import values
  from tensorflow.python.eager import context
  from tensorflow.python.eager import test
  from tensorflow.python.ops import lookup_ops
label_desc: Use image node_id 3 for calling the PSStrategySaveAndLoadTest obj's underlying member method code with example usage: obj.load_and_run_v1(model_dir, inputs, signature_key) and returns: session