code: def test_perform_CheckAndRaise_scalar(linker):
      exc_msg = "this is the exception"
      check_and_raise = CheckAndRaise(CustomException, exc_msg)
  
      val = float64("val")
      conds = (val > 0, val > 3)
      y = check_and_raise(val, *conds)
  
      assert all(isinstance(i.type, ScalarType) for i in y.owner.inputs)
      assert isinstance(y.type, ScalarType)
  
      mode = Mode(linker=linker)
      y_fn = pytensor.function([val], y, mode=mode)
  
      with pytest.raises(CustomException, match=exc_msg):
          y_fn(0.0)
  
      assert y_fn(4.0) == 4.0
  
      if linker == "cvm":
          assert isinstance(
              y_fn.maker.fgraph.outputs[0].owner.inputs[0].owner.op,
              CheckAndRaise,
          )
          assert hasattr(y_fn.vm.thunks[-2], "cthunk")
  
      (y_grad,) = pytensor.grad(y, [val])
      y_fn = pytensor.function(
          [val], y_grad, mode=Mode(linker, OPT_FAST_RUN)
      )
  
      assert np.array_equal(y_fn(4.0), 1.0)
  
imports: import numpy
  import pytest
  import scipy.sparse
  import pytensor
  import pytensor.tensor
  from pytensor.compile.mode import OPT_FAST_RUN, Mode
  from pytensor.graph import vectorize_graph
  from pytensor.graph.basic import Constant, equal_computations
  from pytensor.raise_op import Assert, CheckAndRaise, assert_op
  from pytensor.scalar.basic import ScalarType, float64
  from pytensor.sparse import as_sparse_variable
  from pytensor.tensor.basic import second
  from pytensor.tensor.elemwise import DimShuffle
  from tests import unittest_tools
label_desc: Use image node_id 6 for calling a global function with example usage: test_perform_CheckAndRaise_scalar(linker) without return types