def _retrieve_source_keys(
    sourced_tensors: Iterable[tf.Tensor],
    structured_inputs: Mapping[str, common_types.TensorType]) -> Set[str]:
  """Retrieve input keys that sourced_tensors depend on."""
  result = set()
  sinks = [t.op for t in sourced_tensors]
  sources = retrieve_sources(sinks, ignore_control_dependencies=True)
  hashable_sources = [tf_utils.hashable_tensor_or_op(s) for s in sources]
  for key, value in structured_inputs.items():
    components = ([
        tf_utils.hashable_tensor_or_op(v)
        for v in _decompose_tensor_or_op(value)
    ])
    if any([s in components for s in hashable_sources]):
      result.add(key)
  return result
Retrieve input keys that sourced_tensors depend on.
tensorflow_transform/graph_tools.py