code: def test_RandomVariable_basics():
      str_res = str(
          RandomVariable(
              "normal",
              0,
              [0, 0],
              "float32",
              inplace=True,
          )
      )
  
      assert str_res == "normal_rv{0, (0, 0), float32, True}"
  
      # `ndims_params` should be a `Sequence` type
      with pytest.raises(TypeError, match="^Parameter ndims_params*"):
          RandomVariable(
              "normal",
              0,
              0,
              config.floatX,
              inplace=True,
          )
  
      # `size` should be a `Sequence` type
      with pytest.raises(TypeError, match="^Parameter size*"):
          RandomVariable(
              "normal",
              0,
              [0, 0],
              config.floatX,
              inplace=True,
          )(0, 1, size={1, 2})
  
      # No dtype
      with pytest.raises(TypeError, match="^dtype*"):
          RandomVariable(
              "normal",
              0,
              [0, 0],
              inplace=True,
          )(0, 1)
  
      # Confirm that `inplace` works
      rv = RandomVariable(
          "normal",
          0,
          [0, 0],
          "normal",
          inplace=True,
      )
  
      assert rv.inplace
      assert rv.destroy_map == {0: [0]}
  
      # A no-params `RandomVariable`
      rv = RandomVariable(name="test_rv", ndim_supp=0, ndims_params=())
  
      with pytest.raises(TypeError):
          rv.make_node(rng=1)
  
      # `RandomVariable._infer_shape` should handle no parameters
      rv_shape = rv._infer_shape(pt.constant([]), (), [])
      assert rv_shape.equals(pt.constant([], dtype="int64"))
  
      # Integer-specified `dtype`
      dtype_1 = all_dtypes[1]
      rv_node = rv.make_node(None, None, 1)
      rv_out = rv_node.outputs[1]
      rv_out.tag.test_value = 1
  
      assert rv_out.dtype == dtype_1
  
      with pytest.raises(NullTypeGradError):
          grad(rv_out, [rv_node.inputs[0]])
  
imports: import numpy
  import pytest
  import pytensor.tensor
  from pytensor import config, function
  from pytensor.gradient import NullTypeGradError, grad
  from pytensor.graph.replace import vectorize_node
  from pytensor.raise_op import Assert
  from pytensor.tensor.math import eq
  from pytensor.tensor.random import normal
  from pytensor.tensor.random.op import RandomState, RandomVariable, default_rng
  from pytensor.tensor.shape import specify_shape
  from pytensor.tensor.type import all_dtypes, iscalar, tensor
label_desc: Use image node_id 2 for calling a global function with example usage: test_RandomVariable_basics() without return types