class_docstr: This optimizer performs two important functions:
  
  1) It has a 'requirement' of the destroyhandler. This means that the fgraph
  will include it as a feature for this optimization, and keep this feature
  enabled for subsequent optimizations. All optimizations that work inplace
  on any of their inputs must run *after* this optimization to ensure that
  the DestroyHandler has been included in the fgraph.
  
  2) It tries to replace each output with an Op that purports to destroy it
  (but it won't I promise). If this replacement succeeds it means that
  there is a bug in pytensor. It should not be possible to destroy outputs.
class_docstr_tok: ["This","optimizer","performs","two","important","functions",":","1",")","It","has","a","'requirement","'","of","the","destroyhandler",".","This","means","that","the","fgraph","will","include","it","as","a","feature","for","this","optimization",",","and","keep","this","feature","enabled","for","subsequent","optimizations",".","All","optimizations","that","work","inplace","on","any","of","their","inputs","must","run","*","after","*","this","optimization","to","ensure","that","the","DestroyHandler","has","been","included","in","the","fgraph",".","2",")","It","tries","to","replace","each","output","with","an","Op","that","purports","to","destroy","it","(","but","it","wo","n't","I","promise",")",".","If","this","replacement","succeeds","it","means","that","there","is","a","bug","in","pytensor",".","It","should","not","be","possible","to","destroy","outputs","."]
code: def add_requirements(self, fgraph):
      super().add_requirements(fgraph)
      fgraph.attach_feature(DestroyHandler())
  
imports: import logging
  import warnings
  from typing import Literal, Optional, Union
  from pytensor.compile.function.types import Supervisor
  from pytensor.configdefaults import config
  from pytensor.graph.destroyhandler import DestroyHandler
  from pytensor.graph.rewriting.basic import CheckStackTraceRewriter, GraphRewriter, MergeOptimizer, NodeProcessingGraphRewriter
  from pytensor.graph.rewriting.db import EquilibriumDB, LocalGroupDB, RewriteDatabase, RewriteDatabaseQuery, SequenceDB, TopoDB
  from pytensor.link.basic import Linker, PerformLinker
  from pytensor.link.c.basic import CLinker, OpWiseCLinker
  from pytensor.link.jax.linker import JAXLinker
  from pytensor.link.numba.linker import NumbaLinker
  from pytensor.link.vm import VMLinker
label_desc: Use image node_id 2 for calling the AddDestroyHandler obj's underlying member method code with example usage: obj.add_requirements(fgraph) without return types