code: def dependency_of_targets(targets, op):
      """
      Check that op is in the subgraph induced by the dependencies of targets.
      The result is memoized.
  
      This is useful if some SessionRunHooks should be run only together with certain ops.
  
      Args:
          targets: a tuple of ops or tensors. The targets to find dependencies of.
          op (tf.Operation or tf.Tensor):
  
      Returns:
          bool: True if any one of `targets` depend on `op`.
      """
      # TODO tensorarray? sparsetensor?
      if isinstance(op, tf.Tensor):
          op = op.op
      assert isinstance(op, tf.Operation), op
  
      try:
          from tensorflow.contrib.graph_editor import (
              get_backward_walk_ops,
          )  # deprecated
      except ImportError:
          from tensorflow.python.ops.op_selector import (
              get_backward_walk_ops,
          )
      # alternative implementation can use graph_util.extract_sub_graph
      dependent_ops = get_backward_walk_ops(
          targets, control_inputs=True
      )
      return op in dependent_ops
  
imports: import tensorflow
  from ..utils.argtools import graph_memoized
label_desc: Use image node_id 1 for calling a global function with example usage: dependency_of_targets(targets, op) and returns: unknown