code: def _squash_transformations(expr):
      if isinstance(expr, relay.expr.Constant):
          return expr.data.numpy()
      assert isinstance(expr, relay.expr.Call)
      assert len(expr.args) == 1
  
      prev_kernel = _squash_transformations(expr.args[0])
      attrs = expr.attrs
  
      if expr.op.name == "layout_transform":
          return change_numpy_layout(
              prev_kernel, attrs.src_layout, attrs.dst_layout
          )
      elif expr.op.name == "cast":
          return prev_kernel.astype(attrs.dtype)
      elif kernel.op.name == "expand_dims":
          new_axes = range(attrs.axis, attrs.axis + attrs.num_newaxis)
          return np.expand_dims(prev_kernel, tuple(new_axes))
      else:
          raise RuntimeError(f"Invalid kernel transformation '{expr}'!")
  
file_path: tvm/python/tvm/topi/arm_cpu/qnn_alter_op.py
imports: from typing import Iterable
  import numpy
  from tvm import nd, relay, target
  from ..utils import get_const_tuple
  from ..nn import qnn_conv2d_alter_layout, add_alter_layout, qnn_requantize_alter_layout
label_desc: Use image node_id 4 for calling a global function with example usage: _squash_transformations(expr) and returns: expr, change_numpy_layout, prev_kernel, np