# Path: tensorflow_transform/py_func/pyfunc_helper.py
# _PYFUNC_COLLECTION_KEY = 'pyfuncs'
# class _PyFuncDef(tfx_namedtuple.namedtuple('_PyFuncDef', ['token', 'func'])):
#   def from_proto(attr_value, import_scope=None):
#   def from_proto_string(proto_str, import_scope=None):
#   def to_proto(self, export_scope=None):
# def insert_pyfunc(func, Tout, stateful, name, *args):  # pylint: disable=invalid-name
# def register_pyfuncs_from_saved_transform(graph, meta_graph, loaded_in_tf2):


from tensorflow_transform.py_func import pyfunc_helper

  The underlying reason for this limited support is that `tf.py_func` ops were
  not designed to be serialized since they contain a reference to arbitrary
  Python functions. This function pickles those functions and including them in
  the graph, and `transform_raw_features` similarly unpickles the functions.
  But unpickling requires a Python environment, so there it's not possible to
  provide support in non-Python languages for loading such ops.  Therefore
  loading these ops in libraries such as TensorFlow Serving is not supported.

  Note: This API can only be used when TF2 is disabled or
  `tft_beam.Context.force_tf_compat_v1=True`.

  Args:
    func: A Python function, which accepts a list of NumPy `ndarray` objects
      having element types that match the corresponding `tf.Tensor` objects
      in `*args`, and returns a list of `ndarray` objects (or a single
      `ndarray`) having element types that match the corresponding values
      in `Tout`.
    Tout: A list or tuple of tensorflow data types or a single tensorflow data
      type if there is only one, indicating what `func` returns.
    stateful: (Boolean.) If True, the function should be considered stateful.
      If a function is stateless, when given the same input it will return the
      same output and have no observable side effects. Optimizations such as
      common subexpression elimination are only performed on stateless
      operations.
    name: A name for the operation (optional).
    *args: The list of `Tensor`s to apply the arguments to.
  Returns:
    A `Tensor` representing the application of the function.
  """

# Path: tensorflow_transform/py_func/pyfunc_helper.py
# _PYFUNC_COLLECTION_KEY = 'pyfuncs'
# class _PyFuncDef(tfx_namedtuple.namedtuple('_PyFuncDef', ['token', 'func'])):
#   def from_proto(attr_value, import_scope=None):
#   def from_proto_string(proto_str, import_scope=None):
#   def to_proto(self, export_scope=None):
# def insert_pyfunc(func, Tout, stateful, name, *args):  # pylint: disable=invalid-name
# def register_pyfuncs_from_saved_transform(graph, meta_graph, loaded_in_tf2):


# Path: tensorflow_transform/py_func/api.py
from tensorflow_transform.py_func import pyfunc_helper


  The underlying reason for this limited support is that `tf.py_func` ops were
  not designed to be serialized since they contain a reference to arbitrary
  Python functions. This function pickles those functions and including them in
  the graph, and `transform_raw_features` similarly unpickles the functions.
  But unpickling requires a Python environment, so there it's not possible to
  provide support in non-Python languages for loading such ops.  Therefore
  loading these ops in libraries such as TensorFlow Serving is not supported.

  Note: This API can only be used when TF2 is disabled or
  `tft_beam.Context.force_tf_compat_v1=True`.

  Args:
    func: A Python function, which accepts a list of NumPy `ndarray` objects
      having element types that match the corresponding `tf.Tensor` objects
      in `*args`, and returns a list of `ndarray` objects (or a single
      `ndarray`) having element types that match the corresponding values
      in `Tout`.
    Tout: A list or tuple of tensorflow data types or a single tensorflow data
      type if there is only one, indicating what `func` returns.
    stateful: (Boolean.) If True, the function should be considered stateful.
      If a function is stateless, when given the same input it will return the
      same output and have no observable side effects. Optimizations such as
      common subexpression elimination are only performed on stateless
      operations.
    name: A name for the operation (optional).
    *args: The list of `Tensor`s to apply the arguments to.
  Returns:
    A `Tensor` representing the application of the function.
  """

  return pyfunc_helper.insert_pyfunc(func, Tout, stateful, name, *args)