class_docstr: A database of rewrites that should be applied until equilibrium is reached.
  
  Canonicalize, Stabilize, and Specialize are all equilibrium rewriters.
  
  Notes
  -----
  We can use `NodeRewriter` and `GraphRewriter` since `EquilibriumGraphRewriter`
  supports both.
  
  It is probably not a good idea to have both ``ignore_newtrees == False``
  and ``tracks_on_change_inputs == True``.
class_docstr_tok: ["A","database","of","rewrites","that","should","be","applied","until","equilibrium","is","reached",".","Canonicalize",",","Stabilize",",","and","Specialize","are","all","equilibrium","rewriters",".","Notes","--","--","-","We","can","use","`","NodeRewriter","`","and","`","GraphRewriter","`","since","`","EquilibriumGraphRewriter","`","supports","both",".","It","is","probably","not","a","good","idea","to","have","both","``","ignore_newtrees","==","False","``","and","``","tracks_on_change_inputs","==","True","``","."]
code: def query(self, *tags, **kwtags):
      _rewriters = super().query(*tags, **kwtags)
      final_rewriters = [
          o for o in _rewriters if self.__final__.get(o.name, False)
      ]
      cleanup_rewriters = [
          o for o in _rewriters if self.__cleanup__.get(o.name, False)
      ]
      rewriters = [
          o
          for o in _rewriters
          if o not in final_rewriters and o not in cleanup_rewriters
      ]
      if len(final_rewriters) == 0:
          final_rewriters = None
      if len(cleanup_rewriters) == 0:
          cleanup_rewriters = None
      return pytensor_rewriting.EquilibriumGraphRewriter(
          rewriters,
          max_use_ratio=config.optdb__max_use_ratio,
          ignore_newtrees=self.ignore_newtrees,
          tracks_on_change_inputs=self.tracks_on_change_inputs,
          failure_callback=pytensor_rewriting.NodeProcessingGraphRewriter.warn_inplace,
          final_rewriters=final_rewriters,
          cleanup_rewriters=cleanup_rewriters,
      )
  
imports: import copy
  import math
  import sys
  from collections.abc import Iterable, Sequence
  from functools import cmp_to_key
  from io import StringIO
  from typing import Optional, Union
  from pytensor.configdefaults import config
  from pytensor.graph.rewriting import basic
  from pytensor.misc.ordered_set import OrderedSet
  from pytensor.utils import DefaultOrderedDict
label_desc: Use image node_id 3 for calling the EquilibriumDB obj's underlying member method code with example usage: obj.query() and returns: pytensor_rewriting