code: def local_rv_size_lift(fgraph, node):
      """Lift the ``size`` parameter in a ``RandomVariable``.
  
      In other words, this will broadcast the distribution parameters by adding
      the extra dimensions implied by the ``size`` parameter, and remove the
      ``size`` parameter in the process.
  
      For example, ``normal(0, 1, size=(1, 2))`` becomes
      ``normal([[0, 0]], [[1, 1]], size=())``.
  
      """
  
      if not isinstance(node.op, RandomVariable):
          return
  
      rng, size, dtype, *dist_params = node.inputs
  
      dist_params = broadcast_params(dist_params, node.op.ndims_params)
  
      if get_vector_length(size) > 0:
          dist_params = [
              broadcast_to(
                  p,
                  (
                      tuple(size)
                      + (
                          tuple(p.shape)[-node.op.ndims_params[i] :]
                          if node.op.ndims_params[i] > 0
                          else ()
                      )
                  )
                  if node.op.ndim_supp > 0
                  else size,
              )
              for i, p in enumerate(dist_params)
          ]
      else:
          return
  
      new_node = node.op.make_node(rng, None, dtype, *dist_params)
  
      if config.compute_test_value != "off":
          compute_test_value(new_node)
  
      return new_node.outputs
  
imports: from itertools import chain
  from pytensor.compile import optdb
  from pytensor.configdefaults import config
  from pytensor.graph import ancestors
  from pytensor.graph.op import compute_test_value
  from pytensor.graph.rewriting.basic import copy_stack_trace, in2out, node_rewriter
  from pytensor.scalar import integer_types
  from pytensor.tensor import NoneConst
  from pytensor.tensor.basic import constant, get_vector_length
  from pytensor.tensor.elemwise import DimShuffle
  from pytensor.tensor.extra_ops import broadcast_to
  from pytensor.tensor.random.op import RandomVariable
  from pytensor.tensor.random.utils import broadcast_params
  from pytensor.tensor.shape import Shape, Shape_i, shape_padleft
  from pytensor.tensor.subtensor import AdvancedSubtensor, AdvancedSubtensor1, Subtensor, as_index_variable, get_idx_list
  from pytensor.tensor.type_other import SliceType
label_desc: Use image node_id 3 for calling a global function with example usage: local_rv_size_lift(fgraph, node) and returns: new_node