code: def test_ifelse_mixture_multiple_components():
      rng = np.random.default_rng(968)
  
      if_var = pt.scalar("if_var", dtype="bool")
      comp_then1 = pt.random.normal(size=(2,), name="comp_true1")
      comp_then2 = comp_then1 + pt.random.normal(
          size=(2, 2), name="comp_then2"
      )
      comp_else1 = pt.random.halfnormal(size=(4,), name="comp_else1")
      comp_else2 = pt.random.halfnormal(size=(4, 4), name="comp_else2")
  
      mix_rv1, mix_rv2 = ifelse(
          if_var,
          [comp_then1, comp_then2],
          [comp_else1, comp_else2],
          name="mix",
      )
      mix_vv1 = mix_rv1.clone()
      mix_vv2 = mix_rv2.clone()
      mix_logp1, mix_logp2 = conditional_logp(
          {mix_rv1: mix_vv1, mix_rv2: mix_vv2}
      ).values()
      assert_no_rvs(mix_logp1)
      assert_no_rvs(mix_logp2)
  
      fn = function(
          [if_var, mix_vv1, mix_vv2], mix_logp1.sum() + mix_logp2.sum()
      )
      mix_vv1_test = np.abs(rng.normal(size=(2,)))
      mix_vv2_test = np.abs(rng.normal(size=(2, 2)))
      np.testing.assert_almost_equal(
          fn(True, mix_vv1_test, mix_vv2_test),
          sp.norm(0, 1).logpdf(mix_vv1_test).sum()
          + sp.norm(mix_vv1_test, 1).logpdf(mix_vv2_test).sum(),
      )
      mix_vv1_test = np.abs(rng.normal(size=(4,)))
      mix_vv2_test = np.abs(rng.normal(size=(4, 4)))
      np.testing.assert_almost_equal(
          fn(False, mix_vv1_test, mix_vv2_test),
          sp.halfnorm(0, 1).logpdf(mix_vv1_test).sum()
          + sp.halfnorm(0, 1).logpdf(mix_vv2_test).sum(),
      )
  
imports: import numpy
  import pytensor
  import pytensor.tensor
  import pytest
  import scipy.stats.distributions
  from pytensor import function
  from pytensor.graph.basic import Variable
  from pytensor.ifelse import ifelse
  from pytensor.tensor.random.basic import CategoricalRV
  from pytensor.tensor.shape import shape_tuple
  from pytensor.tensor.subtensor import AdvancedSubtensor, AdvancedSubtensor1, Subtensor, as_index_constant
  from pymc.logprob.abstract import MeasurableVariable
  from pymc.logprob.basic import conditional_logp, logp
  from pymc.logprob.mixture import MeasurableSwitchMixture, expand_indices
  from pymc.logprob.rewriting import construct_ir_fgraph
  from pymc.logprob.utils import dirac_delta
  from pymc.testing import assert_no_rvs
  from tests.logprob.utils import scipy_logprob
label_desc: Use image node_id 15 for calling a global function with example usage: test_ifelse_mixture_multiple_components() without return types