code: def test_broadcast_matmul(self):
      g = self.create_empty_graph()
      constant = self.insert_tensor_constant(g, torch.ones(5, 1, 2))
      constant_2 = self.insert_tensor_constant(
          g, torch.ones(3, 1, 2, 1)
      )
      shape = g_op(g, "MatMul", constant, constant_2)
      self.run_test(
          g, shape.node(), expect_tensor("Float", shape=(3, 5, 1, 1))
      )
  
      # test when first input is of rank 1
      g = self.create_empty_graph()
      constant = self.insert_tensor_constant(g, torch.ones(2))
      constant_2 = self.insert_tensor_constant(
          g, torch.ones(3, 1, 2, 1)
      )
      shape = g_op(g, "MatMul", constant, constant_2)
      self.run_test(
          g, shape.node(), expect_tensor("Float", shape=(3, 1, 1))
      )
  
      # test when second input is of rank 1
      g = self.create_empty_graph()
      constant = self.insert_tensor_constant(g, torch.ones(5, 1, 2))
      constant_2 = self.insert_tensor_constant(g, torch.ones(2))
      shape = g_op(g, "MatMul", constant, constant_2)
      self.run_test(
          g, shape.node(), expect_tensor("Float", shape=(5, 1))
      )
  
      # test when both inputs are of rank 1
      g = self.create_empty_graph()
      constant = self.insert_tensor_constant(g, torch.ones(2))
      constant_2 = self.insert_tensor_constant(g, torch.ones(2))
      shape = g_op(g, "MatMul", constant, constant_2)
      self.run_test(g, shape.node(), expect_tensor("Float", shape=()))
  
imports: import io
  import numpy
  import onnx
  import pytorch_test_common
  import torch
  from pytorch_test_common import skipIfUnsupportedMinOpsetVersion
  from torch.onnx import _constants, utils
  from torch.onnx._globals import GLOBALS
  from torch.onnx._internal import jit_utils
  from torch.testing._internal import common_utils
label_desc: Use image node_id 16 for calling the TestONNXShapeInference obj's underlying member method code with example usage: obj.test_broadcast_matmul() without return types