def _decompose_tensor_or_op(tensor_or_op):
  """Yields the raw components of a `tf.CompositeTensor`.

  If tensor_or_op is a `tf.Operation`, or `tf.Tensor`, then
  _decompose_tensor_or_op will act as a pass through.

  Args:
    tensor_or_op: `tf.Tensor`, `tf.CompositeTensor`, or `tf.Operation`.

  Yields:
    A tf.Tensor or tf.Operation, depending on what tensor_or_op is.
  """
  if isinstance(tensor_or_op, composite_tensor.CompositeTensor):
    for component in tf.nest.flatten(tensor_or_op, expand_composites=True):
      yield component
  else:
    yield tensor_or_op
Yields the raw components of a `tf.CompositeTensor`.

  If tensor_or_op is a `tf.Operation`, or `tf.Tensor`, then
  _decompose_tensor_or_op will act as a pass through.

  Args:
    tensor_or_op: `tf.Tensor`, `tf.CompositeTensor`, or `tf.Operation`.

  Yields:
    A tf.Tensor or tf.Operation, depending on what tensor_or_op is.
  
tensorflow_transform/graph_tools.py