code: def test_jax_IncSubtensor_boolean_indexing_reexpressible():
      """Setting or incrementing values with boolean indexing.
  
      This test ensures that `AdvancedIncSubtensor` `Op`s with boolean indexing is
      replaced with an equivalent `Switch` `Op`, using the
      `boolean_indexing_set_of_inc` rewrite.
  
      JAX forces users to re-express this logic manually, so this is an
      improvement over its user interface.
  
      """
      rng = np.random.default_rng(213234)
      x_np = rng.uniform(-1, 1, size=(4, 5)).astype(config.floatX)
  
      x_pt = pt.matrix("x")
      mask_pt = pt.as_tensor(x_pt) > 0
      out_pt = pt_subtensor.set_subtensor(x_pt[mask_pt], 0.0)
      assert isinstance(
          out_pt.owner.op, pt_subtensor.AdvancedIncSubtensor
      )
      out_fg = FunctionGraph([x_pt], [out_pt])
      compare_jax_and_py(out_fg, [x_np])
  
      mask_pt = pt.as_tensor(x_pt) > 0
      out_pt = pt_subtensor.inc_subtensor(x_pt[mask_pt], 1.0)
      assert isinstance(
          out_pt.owner.op, pt_subtensor.AdvancedIncSubtensor
      )
      out_fg = FunctionGraph([x_pt], [out_pt])
      compare_jax_and_py(out_fg, [x_np])
  
file_path: pytensor/tests/link/jax/test_subtensor.py
imports: import numpy
  import pytest
  import pytensor.tensor
  from pytensor.configdefaults import config
  from pytensor.graph.fg import FunctionGraph
  from pytensor.tensor import subtensor
  from pytensor.tensor.rewriting.jax import boolean_indexing_set_or_inc, boolean_indexing_sum
  from tests.link.jax.test_basic import compare_jax_and_py
label_desc: Use image node_id 7 for calling a global function with example usage: test_jax_IncSubtensor_boolean_indexing_reexpressible() without return types