class_docstr: Graph optimizer for inserting Gemm operations.
class_docstr_tok: ["Graph","optimizer","for","inserting","Gemm","operations","."]
code: def print_profile(cls, stream, prof, level=0):
      blanc = "    " * level
      print(blanc, cls.__name__, file=stream)
      print(blanc, " nb_iter", prof[1], file=stream)
      print(blanc, " nb_replacement", prof[2], file=stream)
      print(
          blanc, " nb_replacement_didn_t_remove", prof[3], file=stream
      )
      print(blanc, " nb_inconsistency_make", prof[4], file=stream)
      print(blanc, " nb_inconsistency_replace", prof[5], file=stream)
      print(blanc, " time_canonicalize", prof[6], file=stream)
      print(blanc, " time_factor_can", prof[7], file=stream)
      print(blanc, " time_factor_list", prof[8], file=stream)
      print(blanc, " time_toposort", prof[9], file=stream)
      print(blanc, " validate_time", prof[10], file=stream)
      print(blanc, " callback_time", prof[11], file=stream)
      if prof[11] > 1:
          print(blanc, " callbacks_time", file=stream)
          for i in sorted(prof[12].items(), key=lambda a: a[1]):
              if i[1] > 0:
                  print(i)
  
imports: import copy
  import logging
  import time
  import numpy
  from pytensor.tensor.rewriting.basic import register_specialize
  import pytensor.scalar
  from pytensor.compile.mode import optdb
  from pytensor.configdefaults import config
  from pytensor.graph.features import ReplacementDidNotRemoveError, ReplaceValidate
  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
  from pytensor.tensor import basic
  from pytensor.tensor.blas import Dot22, _dot22, _dot22scalar, batched_dot, gemm_inplace, gemm_no_inplace, gemv_inplace, gemv_no_inplace, ger, ger_destructive
  from pytensor.tensor.elemwise import DimShuffle, Elemwise
  from pytensor.tensor.exceptions import NotScalarConstantError
  from pytensor.tensor.math import Dot, _matrix_matrix_matmul, add, mul, neg, sub
  from pytensor.tensor.rewriting.elemwise import local_dimshuffle_lift
  from pytensor.tensor.type import DenseTensorType, TensorType, integer_dtypes, values_eq_approx_remove_inf_nan
label_desc: Use image node_id 4 for calling the GemmOptimizer obj's underlying member method code with example usage: obj.print_profile(cls, stream, prof, level) without return types