code: def check_blockwise_runtime_broadcasting(mode):
      a = tensor("a", shape=(None, 3, 5))
      b = tensor("b", shape=(None, 5, 3))
  
      out = a @ b
      fn = function(
          [a, b],
          out,
          mode=get_mode(mode).excluding(
              specialize_matmul_to_batched_dot.__name__
          ),
      )
      assert isinstance(fn.maker.fgraph.outputs[0].owner.op, Blockwise)
  
      for valid_test_values in [
          (
              np.ones((2, 3, 5)).astype(config.floatX),
              np.ones((2, 5, 3)).astype(config.floatX),
          ),
          (
              np.ones((1, 3, 5)).astype(config.floatX),
              np.ones((1, 5, 3)).astype(config.floatX),
          ),
      ]:
          batch_dim = valid_test_values[0].shape[0]
          np.testing.assert_allclose(
              fn(*valid_test_values), np.full((batch_dim, 3, 3), 5.0)
          )
  
      for invalid_test_values in [
          (
              np.ones((1, 3, 5)).astype(config.floatX),
              np.ones((2, 5, 3)).astype(config.floatX),
          ),
          (
              np.ones((2, 3, 5)).astype(config.floatX),
              np.ones((1, 5, 3)).astype(config.floatX),
          ),
      ]:
          with pytest.raises(
              ValueError, match="Runtime broadcasting not allowed"
          ):
              fn(*invalid_test_values)
  
      invalid_test_values = (
          np.ones((2, 3, 5)).astype(config.floatX),
          np.ones((3, 5, 3)).astype(config.floatX),
      )
      # Error message is backend specific
      with pytest.raises(ValueError):
          fn(*invalid_test_values)
  
imports: import re
  from itertools import product
  from typing import Optional, Union
  import numpy
  import pytest
  import pytensor
  from pytensor import config, function
  from pytensor.compile import get_mode
  from pytensor.gradient import grad
  from pytensor.graph import Apply, Op
  from pytensor.graph.replace import vectorize_node
  from pytensor.raise_op import assert_op
  from pytensor.tensor import diagonal, log, tensor
  from pytensor.tensor.blockwise import Blockwise, vectorize_node_fallback
  from pytensor.tensor.nlinalg import MatrixInverse
  from pytensor.tensor.rewriting.blas import specialize_matmul_to_batched_dot
  from pytensor.tensor.slinalg import Cholesky, Solve, cholesky, solve_triangular
  from pytensor.tensor.utils import _parse_gufunc_signature
label_desc: Use image node_id 3 for calling a global function with example usage: check_blockwise_runtime_broadcasting(mode) without return types