docstr: Test that function replaces values above an intermediate RV.
docstr_tok: ["Test","that","function","replaces","values","above","an","intermediate","RV","."]
code: def test_intermediate_rv(self):
      """Test that function replaces values above an intermediate RV."""
      a = pt.random.uniform(0.0, 1.0)
      a.name = "a"
      a.tag.value_var = a_value_var = a.clone()
  
      b = pt.random.uniform(0, a + 1.0)
      b.name = "b"
      b.tag.value_var = b.clone()
  
      c = pt.random.normal()
      c.name = "c"
      c.tag.value_var = c_value_var = c.clone()
  
      d = pt.log(c + b) + 2.0
  
      initial_replacements = {a: a_value_var, c: c_value_var}
      (res,) = replace_rvs_by_values(
          (d,), rvs_to_values=initial_replacements
      )
  
      # Assert that the only RandomVariable that remains in the graph is `b`
      res_ancestors = list(ancestors((res,)))
  
      assert (
          len(
              list(
                  n
                  for n in res_ancestors
                  if n.owner
                  and isinstance(n.owner.op, MeasurableVariable)
              )
          )
          == 1
      )
  
      assert c_value_var in res_ancestors
      assert a_value_var in res_ancestors
  
imports: import numpy
  import pytensor
  import pytest
  from pytensor import function
  from pytensor import tensor
  from pytensor.compile import get_default_mode
  from pytensor.graph.basic import ancestors, equal_computations
  from pytensor.tensor.random.op import RandomVariable
  import pymc
  from pymc import SymbolicRandomVariable, inputvars
  from pymc.distributions.transforms import Interval
  from pymc.logprob.abstract import MeasurableVariable
  from pymc.logprob.basic import logp
  from pymc.logprob.utils import ParameterValueError, check_potential_measurability, dirac_delta, replace_rvs_by_values
  from pymc.testing import assert_no_rvs
  from tests.logprob.utils import create_pytensor_params, scipy_logprob_tester
label_desc: Use image node_id 2 for calling the TestReplaceRVsByValues obj's underlying member method code with example usage: obj.test_intermediate_rv() without return types