code: def test_bcast_rv_logp():
      """Test that derived logp for broadcasted RV is correct"""
  
      x_rv = pt.random.normal(name="x")
      broadcasted_x_rv = pt.broadcast_to(x_rv, (2,))
      broadcasted_x_rv.name = "broadcasted_x"
      broadcasted_x_vv = broadcasted_x_rv.clone()
  
      logp = conditional_logp({broadcasted_x_rv: broadcasted_x_vv})
      logp_combined = pt.add(*logp.values())
      valid_logp = logp_combined.eval({broadcasted_x_vv: [0, 0]})
  
      assert valid_logp.shape == ()
      assert np.isclose(valid_logp, st.norm.logpdf(0))
  
      # It's not possible for broadcasted dimensions to have different values
      # This should either raise or return -inf
      invalid_logp = logp_combined.eval({broadcasted_x_vv: [0, 1]})
      assert invalid_logp == -np.inf
  
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 3 for calling a global function with example usage: test_bcast_rv_logp() without return types