code: def test_re_export_tf2_saved_model_to_tf1(
      self,
      preprocessing_fn_getter,
      expected_output,
      test_input,
      asset_file_contents=None,
  ):
      asset_file = None
      if asset_file_contents is not None:
          asset_file_path = os.path.join(
              tempfile.mkdtemp(dir=self.get_temp_dir()), "asset"
          )
          file_io.write_string_to_file(
              asset_file_path, asset_file_contents
          )
          asset_file = tf.constant(asset_file_path)
  
      input_specs = {"input": tf.TensorSpec([], dtype=tf.string)}
      export_path = _create_test_saved_model(
          False,
          input_specs,
          preprocessing_fn_getter(asset_file),
          base_dir=self.get_temp_dir(),
      )
  
      if asset_file is not None:
          os.remove(asset_file.numpy())
      new_export_path = os.path.join(
          tempfile.mkdtemp(dir=self.get_temp_dir()), "export_v1"
      )
  
      builder = tf.compat.v1.saved_model.builder.SavedModelBuilder(
          new_export_path
      )
      # TODO(b/175844561): Investigate why the variable names need to be different
      # for the two graph and session contexts below.
      with tf.compat.v1.Graph().as_default() as g1:
          saved_model_loader = saved_transform_io_v2.SavedModelLoader(
              export_path
          )
          if asset_file_contents is not None:
              self.assertEqual(
                  1,
                  len(
                      g1.get_collection(
                          tf.compat.v1.GraphKeys.ASSET_FILEPATHS
                      )
                  ),
              )
          with tf.compat.v1.Session().as_default() as s1:
              inputs = {"input": tf.compat.v1.placeholder(tf.string)}
              outputs = saved_model_loader.apply_transform_model(inputs)
              predict_signature_def = tf.compat.v1.saved_model.signature_def_utils.predict_signature_def(
                  inputs, outputs
              )
              builder.add_meta_graph_and_variables(
                  s1,
                  ["graph_tag"],
                  signature_def_map={
                      "graph_signature": predict_signature_def
                  },
                  assets_collection=tf.compat.v1.get_collection(
                      tf.compat.v1.GraphKeys.ASSET_FILEPATHS
                  ),
                  main_op=tf.compat.v1.tables_initializer(),
              )
      builder.save()
  
      shutil.rmtree(export_path)
  
      with tf.compat.v1.Graph().as_default() as g2:
          with tf.compat.v1.Session().as_default() as s2:
              meta_graph_def = tf.compat.v1.saved_model.loader.load(
                  s2, ["graph_tag"], new_export_path
              )
              signature = meta_graph_def.signature_def[
                  "graph_signature"
              ]
              output = s2.run(
                  g2.get_tensor_by_name(
                      signature.outputs["output"].name
                  ),
                  feed_dict={
                      g2.get_tensor_by_name(
                          signature.inputs["input"].name
                      ): test_input
                  },
              )
              self.assertEqual(expected_output, output)
              if asset_file_contents is not None:
                  self.assertEqual(
                      1,
                      len(
                          g2.get_collection(
                              tf.compat.v1.GraphKeys.ASSET_FILEPATHS
                          )
                      ),
                  )
  
imports: import os
  import shutil
  import tempfile
  import numpy
  import tensorflow
  from tensorflow_transform import graph_context
  from tensorflow_transform import impl_helper
  from tensorflow_transform import tf_utils
  from tensorflow_transform import test_case
  from tensorflow_transform.py_func.api import apply_pyfunc
  from tensorflow_transform.saved import constants
  from tensorflow_transform.saved import saved_transform_io
  from tensorflow_transform.saved import saved_transform_io_v2
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.python.lib.io import file_io
  from tensorflow.python.ops import script_ops
label_desc: Use image node_id 15 for calling the SavedTransformIOV2Test obj's underlying member method code with example usage: obj.test_re_export_tf2_saved_model_to_tf1(preprocessing_fn_getter, expected_output, test_input, asset_file_contents) without return types