code: def test_switch_mixture_invalid_bcast():
      """Test that we don't mark switches where components are broadcasted as measurable"""
      valid_switch_cond = pt.vector("switch_cond", dtype=bool)
      invalid_switch_cond = pt.matrix("switch_cond", dtype=bool)
  
      valid_true_branch = pt.exp(pt.random.normal(size=(4,)))
      valid_false_branch = pt.abs(pt.random.normal(size=(4,)))
      invalid_false_branch = pt.abs(pt.random.normal(size=()))
  
      valid_mix = pt.switch(
          valid_switch_cond, valid_true_branch, valid_false_branch
      )
      fgraph, _, _ = construct_ir_fgraph({valid_mix: valid_mix.type()})
      assert isinstance(fgraph.outputs[0].owner.op, MeasurableVariable)
      assert isinstance(
          fgraph.outputs[0].owner.op, MeasurableSwitchMixture
      )
  
      invalid_mix = pt.switch(
          invalid_switch_cond, valid_true_branch, valid_false_branch
      )
      fgraph, _, _ = construct_ir_fgraph(
          {invalid_mix: invalid_mix.type()}
      )
      assert not isinstance(
          fgraph.outputs[0].owner.op, MeasurableVariable
      )
  
      invalid_mix = pt.switch(
          valid_switch_cond, valid_true_branch, invalid_false_branch
      )
      fgraph, _, _ = construct_ir_fgraph(
          {invalid_mix: invalid_mix.type()}
      )
      assert not isinstance(
          fgraph.outputs[0].owner.op, MeasurableVariable
      )
  
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 13 for calling a global function with example usage: test_switch_mixture_invalid_bcast() without return types