def shaped_py_func(func, inputs, types, shapes, stateful=True, name=None):
  """Wrapper around tf.py_func that adds static shape information to the output.

  Args:
    func: Python function to call.
    inputs: List of input tensors.
    types: List of output tensor types.
    shapes: List of output tensor shapes.
    stateful: Whether or not the python function is stateful.
    name: Name of the op.

  Returns:
    output_tensors: List of output tensors.
  """
  output_tensors = tf.py_func(
      func=func, inp=inputs, Tout=types, stateful=stateful, name=name)
  for t, s in zip(output_tensors, shapes):
    t.set_shape(s)
  return output_tensors
Wrapper around tf.py_func that adds static shape information to the output.

  Args:
    func: Python function to call.
    inputs: List of input tensors.
    types: List of output tensor types.
    shapes: List of output tensor shapes.
    stateful: Whether or not the python function is stateful.
    name: Name of the op.

  Returns:
    output_tensors: List of output tensors.
  
language/common/utils/tensor_utils.py