class_docstr: Object to store runtime and memory profiling information for all of
  PyTensor's operations: compilation, rewriting, execution.
  
  Parameters
  ----------
  atexit_print : bool
      True means that this object will be printed to stderr (using .summary())
      at the end of the program.
  **kwargs : misc initializers
      These should (but need not) match the names of the class vars declared
      in this class.
class_docstr_tok: ["Object","to","store","runtime","and","memory","profiling","information","for","all","of","PyTensor","'s","operations",":","compilation",",","rewriting",",","execution",".","Parameters","--","--","--","--","--","atexit_print",":","bool","True","means","that","this","object","will","be","printed","to","stderr","(","using",".summary","(",")",")","at","the","end","of","the","program",".","*","*","kwargs",":","misc","initializers","These","should","(","but","need","not",")","match","the","names","of","the","class","vars","declared","in","this","class","."]
code: def print_tips(self, file):
      print(
          """Here are tips to potentially make your code run faster
                   (if you think of new ones, suggest them on the mailing list).
                   Test them first, as they are not guaranteed to always provide a speedup.""",
          file=file,
      )
  
      from pytensor import scalar as ps
      from pytensor.tensor.elemwise import Elemwise
      from pytensor.tensor.math import Dot
  
      scalar_op_amdlibm_no_speed_up = [
          ps.LT,
          ps.GT,
          ps.LE,
          ps.GE,
          ps.EQ,
          ps.NEQ,
          ps.InRange,
          ps.Switch,
          ps.OR,
          ps.XOR,
          ps.AND,
          ps.Invert,
          ps.ScalarMaximum,
          ps.ScalarMinimum,
          ps.Add,
          ps.Mul,
          ps.Sub,
          ps.TrueDiv,
          ps.IntDiv,
          ps.Clip,
          ps.Second,
          ps.Identity,
          ps.Cast,
          ps.Sign,
          ps.Neg,
          ps.Reciprocal,
          ps.Sqr,
      ]
      scalar_op_amdlibm_speed_up = [
          ps.Mod,
          ps.Pow,
          ps.Ceil,
          ps.Floor,
          ps.RoundHalfToEven,
          ps.RoundHalfAwayFromZero,
          ps.Log,
          ps.Log2,
          ps.Log10,
          ps.Log1p,
          ps.Exp,
          ps.Sqrt,
          ps.Abs,
          ps.Cos,
          ps.Sin,
          ps.Tan,
          ps.Tanh,
          ps.Cosh,
          ps.Sinh,
          ps.Sigmoid,
          ps.Softplus,
      ]
  
      def get_scalar_ops(s):
          if isinstance(s, ps.Composite):
              l = []
              for node in s.fgraph.toposort():
                  l += get_scalar_ops(node.op)
              return l
          else:
              return [s]
  
      def list_scalar_op(op):
          if isinstance(op.scalar_op, ps.Composite):
              return get_scalar_ops(op.scalar_op)
          else:
              return [op.scalar_op]
  
      def amdlibm_speed_up(op):
          if not isinstance(op, Elemwise):
              return False
          else:
              l = list_scalar_op(op)
              for s_op in l:
                  if s_op.__class__ in scalar_op_amdlibm_speed_up:
                      return True
                  elif (
                      s_op.__class__
                      not in scalar_op_amdlibm_no_speed_up
                  ):
                      print(
                          "We don't know if amdlibm will accelerate "
                          "this scalar op.",
                          s_op,
                          file=file,
                      )
              return False
  
      def exp_float32_op(op):
          if not isinstance(op, Elemwise):
              return False
          else:
              l = list_scalar_op(op)
              return any(s_op.__class__ in [ps.Exp] for s_op in l)
  
      printed_tip = False
      # tip 1
      if config.floatX == "float64":
          print("  - Try the PyTensor flag floatX=float32", file=file)
          printed_tip = True
  
      # tip 2
      if not config.lib__amblibm and any(
          amdlibm_speed_up(a.op) for (fgraph, a) in self.apply_time
      ):
          print(
              "  - Try installing amdlibm and set the PyTensor flag "
              "lib__amblibm=True. This speeds up only some Elemwise "
              "operation.",
              file=file,
          )
          printed_tip = True
  
      # tip 3
      if not config.lib__amblibm and any(
          exp_float32_op(a.op) and a.inputs[0].dtype == "float32"
          for (fgraph, a) in self.apply_time
      ):
          print(
              "  - With the default gcc libm, exp in float32 is slower "
              "than in float64! Try PyTensor flag floatX=float64, or "
              "install amdlibm and set the pytensor flags lib__amblibm=True",
              file=file,
          )
          printed_tip = True
  
      # tip 4
      for fgraph, a in self.apply_time:
          node = a
          if isinstance(node.op, Dot) and all(
              len(i.type.broadcastable) == 2 for i in node.inputs
          ):
              print(
                  (
                      "  - You have a dot operation that was not rewritten to"
                      " dot22 (which is faster). Make sure the inputs are "
                      "float32 or float64, and are the same for both inputs. "
                      f"Currently they are: {[i.type for i in node.inputs]}"
                  ),
                  file=file,
              )
              printed_tip = True
  
      # tip 5
      # The tip was about MRG_RandomStream which is removed
  
      # tip 6
      for fgraph, a in self.apply_time:
          node = a
          if (
              isinstance(node.op, Dot)
              and len({i.dtype for i in node.inputs}) != 1
          ):
              print(
                  (
                      "  - You have a dot operation that has different dtype "
                      f" for inputs ({[i.type for i in node.inputs]}). Make sure that the inputs have same "
                      " dtype."
                  ),
                  file=file,
              )
              printed_tip = True
  
      # tip 7 was about pool and log softmax on gpu using cudnn
  
      if not printed_tip:
          print("  Sorry, no tip for today.", file=file)
  
imports: import atexit
  import copy
  import logging
  import operator
  import sys
  import time
  from collections import defaultdict
  from contextlib import contextmanager
  from typing import TYPE_CHECKING, Any, Optional, Union
  import numpy
  import pytensor
  from pytensor.configdefaults import config
  from pytensor.graph.basic import Apply, Constant, Variable
  from pytensor.link.utils import get_destroy_dependencies
label_desc: Use image node_id 20 for calling the ProfileStats obj's underlying member method code with example usage: obj.print_tips(file) and returns: l, list, get_scalar_ops, list, False, False, False, any, True