code: def test_scalar_clipped_mixture():
      x = pt.clip(pt.random.normal(loc=1), 0.5, 1.5)
      x.name = "x"
      y = pt.random.beta(1, 2, name="y")
  
      comps = pt.stack([x, y])
      comps.name = "comps"
      idxs = pt.random.bernoulli(0.4, name="idxs")
      mix = comps[idxs]
      mix.name = "mix"
  
      mix_vv = mix.clone()
      mix_vv.name = "mix_val"
      idxs_vv = idxs.clone()
      idxs_vv.name = "idxs_val"
  
      logp = conditional_logp({idxs: idxs_vv, mix: mix_vv})
      logp_combined = pt.sum(
          [pt.sum(factor) for factor in logp.values()]
      )
  
      logp_fn = pytensor.function([idxs_vv, mix_vv], logp_combined)
      assert logp_fn(0, 0.4) == -np.inf
      assert np.isclose(
          logp_fn(0, 0.5), st.norm.logcdf(0.5, 1) + np.log(0.6)
      )
      assert np.isclose(
          logp_fn(0, 1.3), st.norm.logpdf(1.3, 1) + np.log(0.6)
      )
      assert np.isclose(
          logp_fn(1, 0.4), st.beta.logpdf(0.4, 1, 2) + np.log(0.4)
      )
  
file_path: pymc/tests/logprob/test_composite_logprob.py
imports: import numpy
  import pytensor
  import pytensor.tensor
  import pytest
  import scipy.stats
  from pymc import draw, logp
  from pymc.logprob.abstract import MeasurableVariable
  from pymc.logprob.basic import conditional_logp
  from pymc.logprob.rewriting import construct_ir_fgraph
  from pymc.testing import assert_no_rvs
label_desc: Use image node_id 1 for calling a global function with example usage: test_scalar_clipped_mixture() without return types