code: def test_measurable_make_vector_interdependent(reverse):
      """Test that we can obtain a proper graph when stacked RVs depend on each other"""
      x = pt.random.normal(name="x")
      y_rvs = []
      prev_rv = x
      for i in range(3):
          next_rv = pt.random.normal(prev_rv + 1, name=f"y{i}")
          y_rvs.append(next_rv)
          prev_rv = next_rv
  
      if reverse:
          y_rvs = y_rvs[::-1]
  
      ys = pt.stack(y_rvs)
      ys.name = "ys"
  
      x_vv = x.clone()
      ys_vv = ys.clone()
  
      logp = conditional_logp({x: x_vv, ys: ys_vv})
      logp_combined = pt.sum(
          [pt.sum(factor) for factor in logp.values()]
      )
      assert_no_rvs(logp_combined)
  
      y0_vv = y_rvs[0].clone()
      y1_vv = y_rvs[1].clone()
      y2_vv = y_rvs[2].clone()
  
      ref_logp = conditional_logp(
          {x: x_vv, y_rvs[0]: y0_vv, y_rvs[1]: y1_vv, y_rvs[2]: y2_vv}
      )
      ref_logp_combined = pt.sum(
          [pt.sum(factor) for factor in ref_logp.values()]
      )
  
      rng = np.random.default_rng()
      x_vv_test = rng.normal()
      ys_vv_test = rng.normal(size=3)
      np.testing.assert_allclose(
          logp_combined.eval(
              {x_vv: x_vv_test, ys_vv: ys_vv_test}
          ).sum(),
          ref_logp_combined.eval(
              {
                  x_vv: x_vv_test,
                  y0_vv: ys_vv_test[0],
                  y1_vv: ys_vv_test[1],
                  y2_vv: ys_vv_test[2],
              }
          ),
      )
  
imports: import numpy
  import pytensor
  import pytest
  from pytensor import tensor
  from pytensor.graph import RewriteDatabaseQuery
  from pytensor.graph.rewriting.basic import in2out
  from pytensor.graph.rewriting.utils import rewrite_graph
  from pytensor.tensor.basic import Alloc
  from scipy import stats
  from pymc.logprob.basic import conditional_logp, logp
  from pymc.logprob.rewriting import logprob_rewrites_db
  from pymc.logprob.tensor import naive_bcast_rv_lift
  from pymc.testing import assert_no_rvs
label_desc: Use image node_id 5 for calling a global function with example usage: test_measurable_make_vector_interdependent(reverse) without return types