code: def get_destroy_dependencies(
      fgraph: FunctionGraph,
  ) -> dict[Apply, list[Variable]]:
      """Construct a ``dict`` of nodes to variables that are implicit dependencies induced by `Op.destroy_map` and `Op.view_map`
  
      These variable dependencies are in contrast to each node's inputs, which
      are _explicit_ dependencies.
  
      The variables in the values of this ``dict`` would be impossible to compute
      after the current key nodes are evaluated, because node.thunk() is going to
      destroy a common input variable needed by whatever node owns each variable
      in destroy_dependencies.
      """
      order = fgraph.orderings()
      destroy_dependencies = defaultdict(list)
      for node in fgraph.apply_nodes:
          for prereq in order.get(node, []):
              destroy_dependencies[node].extend(prereq.outputs)
      return destroy_dependencies
  
imports: import builtins
  import io
  import re
  import sys
  import traceback
  import warnings
  from collections import Counter, defaultdict
  from collections.abc import Iterable, Sequence
  from keyword import iskeyword
  from operator import itemgetter
  from tempfile import NamedTemporaryFile
  from textwrap import dedent, indent
  from typing import TYPE_CHECKING, Any, Callable, NoReturn, Optional, TextIO, TypeVar, Union, cast
  import numpy
  from pytensor import config, utils
  from pytensor.graph.basic import Apply, Constant, Variable
  from pytensor.graph.fg import FunctionGraph
label_desc: Use image node_id 11 for calling a global function with example usage: get_destroy_dependencies(fgraph) and returns: destroy_dependencies