# Path: tensorflow_transform/saved/constants.py
# TRANSFORM_TAG = 'transform'
# TRANSFORM_SIGNATURE = 'transform_signature'


from tensorflow_transform.saved import constants
from tensorflow.python.saved_model import loader_impl  # pylint: disable=g-direct-tensorflow-import

  Args:
    saved_model: A `SavedModel` protocol buffer.

  Returns:
    The chosen `MetaGraphDef` protocol buffer.  This can be used to further
    extract signature-defs, collection-defs, etc. If tags cannot be found,
    returns None.
  """
  return _choose_meta_graph_def_internal(saved_model, [constants.TRANSFORM_TAG])


def choose_meta_graph_def_and_raise(saved_model):
  """Find a MetaGraphDef in the SavedModel with tag `constants.TRANSFORM_TAG`.

  Args:
    saved_model: A `SavedModel` protocol buffer.

  Returns:
    The chosen `MetaGraphDef` protocol buffer.  This can be used to further
    extract signature-defs, collection-defs, etc.

  Raises:
    RuntimeError: MetaGraphDef associated with the tags cannot be found.
  """
  result = choose_meta_graph_def(saved_model)

  if result is None:
    raise RuntimeError(
        'MetaGraphDef associated with tags {} could not be found in SavedModel'

# Path: tensorflow_transform/saved/constants.py
# TRANSFORM_TAG = 'transform'
# TRANSFORM_SIGNATURE = 'transform_signature'


# Path: tensorflow_transform/saved/saved_model_loader.py
from tensorflow_transform.saved import constants
from tensorflow.python.saved_model import loader_impl  # pylint: disable=g-direct-tensorflow-import


  Args:
    saved_model: A `SavedModel` protocol buffer.

  Returns:
    The chosen `MetaGraphDef` protocol buffer.  This can be used to further
    extract signature-defs, collection-defs, etc. If tags cannot be found,
    returns None.
  """
  return _choose_meta_graph_def_internal(saved_model, [constants.TRANSFORM_TAG])


def choose_meta_graph_def_and_raise(saved_model):
  """Find a MetaGraphDef in the SavedModel with tag `constants.TRANSFORM_TAG`.

  Args:
    saved_model: A `SavedModel` protocol buffer.

  Returns:
    The chosen `MetaGraphDef` protocol buffer.  This can be used to further
    extract signature-defs, collection-defs, etc.

  Raises:
    RuntimeError: MetaGraphDef associated with the tags cannot be found.
  """
  result = choose_meta_graph_def(saved_model)

  if result is None:
    raise RuntimeError(
        'MetaGraphDef associated with tags {} could not be found in SavedModel'

        .format(constants.TRANSFORM_TAG))