code: def non_centered_rewrite():
      @node_rewriter(tracks=[ModelFreeRV])
      def non_centered_param(fgraph: FunctionGraph, node):
          """Rewrite that replaces centered normal by non-centered parametrization."""
  
          rv, value, *dims = node.inputs
          if not isinstance(rv.owner.op, pm.Normal):
              return
          rng, size, dtype, loc, scale = rv.owner.inputs
  
          # Only apply rewrite if size information is explicit
          if size.ndim == 0:
              return None
  
          try:
              is_unit = (
                  pt.get_underlying_scalar_constant_value(loc) == 0
                  and pt.get_underlying_scalar_constant_value(scale)
                  == 1
              )
          except NotScalarConstantError:
              is_unit = False
  
          # Nothing to do here
          if is_unit:
              return
  
          raw_norm = pm.Normal.dist(0, 1, size=size, rng=rng)
          raw_norm.name = f"{rv.name}_raw_"
          raw_norm_value = raw_norm.clone()
          fgraph.add_input(raw_norm_value)
          raw_norm = model_free_rv(
              raw_norm, raw_norm_value, node.op.transform, *dims
          )
  
          new_norm = loc + raw_norm * scale
          new_norm.name = rv.name
          new_norm_det = model_deterministic(new_norm, *dims)
          fgraph.add_output(new_norm_det)
  
          return [new_norm]
  
      return in2out(non_centered_param)
  
file_path: pymc/tests/model/test_fgraph.py
imports: import numpy
  import pytensor.tensor
  import pytest
  from pytensor import config, shared
  from pytensor.graph import Constant, FunctionGraph, node_rewriter
  from pytensor.graph.rewriting.basic import in2out
  from pytensor.tensor.exceptions import NotScalarConstantError
  import pymc
  from pymc.model.fgraph import ModelDeterministic, ModelFreeRV, ModelNamed, ModelObservedRV, ModelPotential, ModelVar, clone_model, fgraph_from_model, model_deterministic, model_free_rv, model_from_fgraph
label_desc: Use image node_id 8 for calling a global function with example usage: non_centered_rewrite() and returns: in2out, list, None