code: def _get_schema(
      self,
      preprocessing_fn,
      use_compat_v1,
      inputs=None,
      input_signature=None,
      create_session=False,
  ):
      if inputs is None:
          inputs = {}
      if input_signature is None:
          input_signature = {}
      if use_compat_v1:
          with tf.compat.v1.Graph().as_default() as graph:
              # Convert eager tensors to graph tensors.
              inputs_copy = {
                  k: tf.constant(v, input_signature[k].dtype)
                  for k, v in inputs.items()
              }
              tensors = preprocessing_fn(inputs_copy)
              if create_session:
                  # Create a session to actually evaluate the annotations and extract
                  # the output schema with annotations applied.
                  with tf.compat.v1.Session(graph=graph) as session:
                      schema = schema_inference.infer_feature_schema(
                          tensors, graph, session
                      )
              else:
                  schema = schema_inference.infer_feature_schema(
                      tensors, graph
                  )
      else:
          tf_func = tf.function(
              preprocessing_fn, input_signature=[input_signature]
          ).get_concrete_function()
          tensors = tf.nest.pack_sequence_as(
              structure=tf_func.structured_outputs,
              flat_sequence=tf_func.outputs,
              expand_composites=True,
          )
          structured_inputs = (
              tf2_utils.get_structured_inputs_from_func_graph(
                  tf_func.graph
              )
          )
          tf_graph_context = graph_context.TFGraphContext(
              module_to_export=tf.Module(),
              temp_dir=os.path.join(
                  self.get_temp_dir(), self._testMethodName
              ),
              evaluated_replacements={},
          )
          concrete_metadata_fn = (
              schema_inference.get_traced_metadata_fn(
                  preprocessing_fn=preprocessing_fn,
                  structured_inputs=structured_inputs,
                  tf_graph_context=tf_graph_context,
                  evaluate_schema_overrides=create_session,
              )
          )
          schema = schema_inference.infer_feature_schema_v2(
              tensors,
              concrete_metadata_fn,
              evaluate_schema_overrides=create_session,
          )
      return schema
  
imports: import functools
  import os
  import tensorflow
  from tensorflow_transform import analyzers
  from tensorflow_transform import common
  from tensorflow_transform import graph_context
  from tensorflow_transform import mappers
  from tensorflow_transform import schema_inference
  from tensorflow_transform import tf2_utils
  from tensorflow_transform import test_case
  from tensorflow_transform.tf_metadata import schema_utils_legacy
  from tensorflow_transform.tf_metadata import schema_utils
  from google.protobuf import text_format
  import unittest
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 1 for calling the SchemaInferenceTest obj's underlying member method code with example usage: obj._get_schema(preprocessing_fn, use_compat_v1, inputs, input_signature, create_session) and returns: schema