def __init__(self, saved_model_dir: str):
    """Init method for SavedModelLoader.

    Args:
      saved_model_dir: A SavedModel directory providing a transform graph.  The
        MetaGraphDef and signature are selected from the SavedModel using keys
        defined in `../constants.py` ('transform' and 'transform_signature',
        respectively).
    """
    imported = tf.saved_model.load(saved_model_dir)
    load_v2_in_compat = constants.TRANSFORM_SIGNATURE in imported.signatures
    if load_v2_in_compat:
      restored_function = imported.signatures[constants.TRANSFORM_SIGNATURE]
      wrapped, structured_inputs, structured_outputs = (
          _restore_from_v1_saved_model(restored_function, saved_model_dir))
    else:
      # transform_fn is now a ConcreteFunction, but was a tf.function. We need
      # to handle both to maintain backward compatiblity. If it's a tf.function,
      # since `input_signature` was specified when exporting the tf function to
      # `SavedModel`, there should be exactly one concrete function present on
      # loading the `SavedModel`.
      if hasattr(imported.transform_fn, 'concrete_functions'):
        concrete_functions = imported.transform_fn.concrete_functions
        assert len(concrete_functions) == 1, concrete_functions
        wrapped = concrete_functions[0]
      else:
        wrapped = imported.transform_fn
      func_graph = wrapped.graph
      structured_inputs = (
          tf2_utils.get_structured_inputs_from_func_graph(func_graph))
      structured_outputs = tf.nest.pack_sequence_as(
          func_graph.structured_outputs,
          func_graph.outputs,
          expand_composites=True)
    outputs_to_inputs_map = _get_output_to_inputs_map(structured_outputs)
    self._initialize(load_v2_in_compat, imported, wrapped, structured_inputs,
                     structured_outputs, outputs_to_inputs_map)
    saved_transform_io._maybe_register_addon_ops()  # pylint: disable=protected-access
Init method for SavedModelLoader.

    Args:
      saved_model_dir: A SavedModel directory providing a transform graph.  The
        MetaGraphDef and signature are selected from the SavedModel using keys
        defined in `../constants.py` ('transform' and 'transform_signature',
        respectively).
    
tensorflow_transform/saved/saved_transform_io_v2.py