class_docstr: Graph optimizer that fuses consecutive Elemwise operations.
class_docstr_tok: ["Graph","optimizer","that","fuses","consecutive","Elemwise","operations","."]
code: def print_profile(stream, prof, level=0):
      blanc = "    " * level
      print(blanc, "FusionOptimizer", file=stream)
      print(blanc, " nb_iter", prof[1], file=stream)
      print(blanc, " nb_replacement", prof[2], file=stream)
      print(blanc, " nb_inconsistency_replace", prof[3], file=stream)
      print(blanc, " validate_time", prof[4], file=stream)
      print(blanc, " callback_time", prof[5], file=stream)
      if prof[5] is not None and prof[5] > 1:
          print(blanc, " callbacks_time", file=stream)
          for i in sorted(prof[6].items(), key=lambda a: a[1])[::-1]:
              if i[1] > 0:
                  print(blanc, "     ", i)
      print(blanc, " time_toposort", prof[7], file=stream)
  
imports: import sys
  from collections import defaultdict, deque
  from collections.abc import Generator
  from functools import cache
  from typing import TypeVar
  from warnings import warn
  import pytensor
  import pytensor.scalar.basic
  from pytensor import clone_replace, compile
  from pytensor.compile.mode import get_target_language
  from pytensor.configdefaults import config
  from pytensor.graph import FunctionGraph
  from pytensor.graph.basic import Apply, Constant, Variable, ancestors, io_toposort
  from pytensor.graph.features import ReplaceValidate
  from pytensor.graph.fg import ApplyOrOutput
  from pytensor.graph.rewriting.basic import EquilibriumGraphRewriter, GraphRewriter, copy_stack_trace, in2out, node_rewriter
  from pytensor.graph.rewriting.db import SequenceDB
  from pytensor.graph.utils import InconsistencyError, MethodNotDefined
  from pytensor.scalar.loop import ScalarLoop
  from pytensor.scalar.math import Grad2F1Loop, _grad_2f1_loop
  from pytensor.tensor.basic import MakeVector, alloc, cast, get_underlying_scalar_constant_value
  from pytensor.tensor.elemwise import CAReduce, DimShuffle, Elemwise
  from pytensor.tensor.exceptions import NotScalarConstantError
  from pytensor.tensor.math import exp
  from pytensor.tensor.rewriting.basic import alloc_like, register_canonicalize, register_specialize
  from pytensor.tensor.shape import shape_padleft
  from pytensor.tensor.variable import TensorConstant, get_unique_constant_value
label_desc: Use image node_id 4 for calling the FusionOptimizer obj's underlying member method code with example usage: obj.print_profile(stream, prof, level) without return types