class_docstr: An `Op` that produces a sample from a random variable.
  
  This is essentially `RandomFunction`, except that it removes the
  `outtype` dependency and handles shape dimension information more
  directly.
class_docstr_tok: ["An","`","Op","`","that","produces","a","sample","from","a","random","variable",".","This","is","essentially","`","RandomFunction","`",",","except","that","it","removes","the","`","outtype","`","dependency","and","handles","shape","dimension","information","more","directly","."]
code: def infer_shape(self, fgraph, node, input_shapes):
      _, size, _, *dist_params = node.inputs
      _, size_shape, _, *param_shapes = input_shapes
  
      try:
          size_len = get_vector_length(size)
      except ValueError:
          size_len = get_underlying_scalar_constant_value(size_shape[0])
  
      size = tuple(size[n] for n in range(size_len))
  
      shape = self._infer_shape(
          size, dist_params, param_shapes=param_shapes
      )
  
      return [None, list(shape)]
  
imports: from collections.abc import Sequence
  from copy import copy
  from typing import Optional, Union
  import numpy
  import pytensor
  from pytensor.configdefaults import config
  from pytensor.graph.basic import Apply, Variable, equal_computations
  from pytensor.graph.op import Op
  from pytensor.graph.replace import _vectorize_node
  from pytensor.misc.safe_asarray import _asarray
  from pytensor.scalar import ScalarVariable
  from pytensor.tensor.basic import as_tensor_variable, concatenate, constant, get_underlying_scalar_constant_value, get_vector_length, infer_static_shape
  from pytensor.tensor.random.type import RandomGeneratorType, RandomStateType, RandomType
  from pytensor.tensor.random.utils import broadcast_params, normalize_size_param
  from pytensor.tensor.shape import shape_tuple
  from pytensor.tensor.type import TensorType, all_dtypes
  from pytensor.tensor.type_other import NoneConst
  from pytensor.tensor.variable import TensorVariable
label_desc: Use image node_id 6 for calling the RandomVariable obj's underlying member method code with example usage: obj.infer_shape(fgraph, node, input_shapes) and returns: list