class_docstr: N-D batch matrix multiplication with Numpy like broadcasting:
  
  * If both ``x, y`` are 1-D, return scalar from dot product.
  * If both ``x, y`` are 2D or higher, perform broadcast on the batch dims
    (all dims except the last ``2``). Ex: ``x.shape == (10, 4, 3)``, ``y.shape == (5, 10, 3, 2)``,
    ``Matmul(x, y).shape == (5, 10, 4, 2)`` Conventional matrix multiplication is
    a special case where both ``x, y`` are exactly 2D. Ex: ``x.shape == (4, 3), y.shape == (3, 2)``,
    ``Matmul(x, y).shape == (4, 2)``.
  * If ``x`` is 1-D, and ``y`` is N-D where ``N >= 2``, ``x`` is first promoted to matrix ``xm``
    by prepending a ``1`` to its dimension, and the resulting ``xm`` is broadcast to ``y`` following
    rule (2) above. Remove the inserted dim afterwards. Ex: ``x.shape == (4), y.shape == (10, 4, 3)``,
    ``xm.shape == (1, 4)``. ``Matmul(xm, y).shape == (10, 1, 3)`` removing inserted dim resulting in
    ``Matmul(x, y).shape == (10, 3)`` (``xm, Matmul(xm, y)`` are immaterial and for illustration only).
  * If ``x`` is N-D where ``N >= 2``, and ``y`` is 1-D, ``y`` is first promoted to matrix ``ym`` by
    appending a ``1`` to its dimension, and the resulting ``ym`` is broadcast to ``x`` following rule
    (2) above. Remove the inserted dim afterwards. Ex: ``x.shape == (10, 3, 4), y.shape == (4,)``,
    ``ym.shape == (4, 1)``. ``Matmul(x, ym).shape == (10, 3, 1)`` removing inserted dim resulting in
    ``Matmul(x, y).shape == (10, 3)`` (``ym, Matmul(x, ym)`` are immaterial and for illustration only).
  
  Parameters
  ----------
  x: tensor<[*,K1], T> (Required)
      * ``x`` must be 1D or higher.
  y: tensor<[*,K2], T> (Required)
      * ``y`` must be 1D or higher.
  transpose_x: const bool (Optional)
      * default to ``False``.
      * ``True`` to transpose the last two dimensions of ``x`` before multiplication. It has no effect when
        ``x`` is 1D.
  transpose_y: const bool (Optional)
      * default to ``False``.
      * ``True`` to transpose the last two dimensions of ``y`` before multiplication. It has no effect when
        ``y`` is 1D.
  
  Returns
  -------
  tensor<*, T>
      * Scalar or tensor output.
  
  Attributes
  ----------
  T: fp32
class_docstr_tok: ["N-D","batch","matrix","multiplication","with","Numpy","like","broadcasting",":","*","If","both","``","x",",","y","``","are","1-D",",","return","scalar","from","dot","product",".","*","If","both","``","x",",","y","``","are","2D","or","higher",",","perform","broadcast","on","the","batch","dims","(","all","dims","except","the","last","``","2","``",")",".","Ex",":","``","x.shape","==","(","10",",","4",",","3",")","``",",","``","y.shape","==","(","5",",","10",",","3",",","2",")","``",",","``","Matmul","(","x",",","y",")",".shape","==","(","5",",","10",",","4",",","2",")","``","Conventional","matrix","multiplication","is","a","special","case","where","both","``","x",",","y","``","are","exactly","2D",".","Ex",":","``","x.shape","==","(","4",",","3",")",",","y.shape","==","(","3",",","2",")","``",",","``","Matmul","(","x",",","y",")",".shape","==","(","4",",","2",")","``",".","*","If","``","x","``","is","1-D",",","and","``","y","``","is","N-D","where","``","N",">","=","2","``",",","``","x","``","is","first","promoted","to","matrix","``","xm","``","by","prepending","a","``","1","``","to","its","dimension",",","and","the","resulting","``","xm","``","is","broadcast","to","``","y","``","following","rule","(","2",")","above",".","Remove","the","inserted","dim","afterwards",".","Ex",":","``","x.shape","==","(","4",")",",","y.shape","==","(","10",",","4",",","3",")","``",",","``","xm.shape","==","(","1",",","4",")","``",".","``","Matmul","(","xm",",","y",")",".shape","==","(","10",",","1",",","3",")","``","removing","inserted","dim","resulting","in","``","Matmul","(","x",",","y",")",".shape","==","(","10",",","3",")","``","(","``","xm",",","Matmul","(","xm",",","y",")","``","are","immaterial","and","for","illustration","only",")",".","*","If","``","x","``","is","N-D","where","``","N",">","=","2","``",",","and","``","y","``","is","1-D",",","``","y","``","is","first","promoted","to","matrix","``","ym","``","by","appending","a","``","1","``","to","its","dimension",",","and","the","resulting","``","ym","``","is","broadcast","to","``","x","``","following","rule","(","2",")","above",".","Remove","the","inserted","dim","afterwards",".","Ex",":","``","x.shape","==","(","10",",","3",",","4",")",",","y.shape","==","(","4",",",")","``",",","``","ym.shape","==","(","4",",","1",")","``",".","``","Matmul","(","x",",","ym",")",".shape","==","(","10",",","3",",","1",")","``","removing","inserted","dim","resulting","in","``","Matmul","(","x",",","y",")",".shape","==","(","10",",","3",")","``","(","``","ym",",","Matmul","(","x",",","ym",")","``","are","immaterial","and","for","illustration","only",")",".","Parameters","--","--","--","--","--","x",":","tensor","<","[","*",",","K1","]",",","T",">","(","Required",")","*","``","x","``","must","be","1D","or","higher",".","y",":","tensor","<","[","*",",","K2","]",",","T",">","(","Required",")","*","``","y","``","must","be","1D","or","higher",".","transpose_x",":","const","bool","(","Optional",")","*","default","to","``","False","``",".","*","``","True","``","to","transpose","the","last","two","dimensions","of","``","x","``","before","multiplication",".","It","has","no","effect","when","``","x","``","is","1D",".","transpose_y",":","const","bool","(","Optional",")","*","default","to","``","False","``",".","*","``","True","``","to","transpose","the","last","two","dimensions","of","``","y","``","before","multiplication",".","It","has","no","effect","when","``","y","``","is","1D",".","Returns","--","--","--","-","tensor","<","*",",","T",">","*","Scalar","or","tensor","output",".","Attributes","--","--","--","--","--","T",":","fp32"]
code: def value_inference(self):
      x = self.x.val
      if self.transpose_x.val:
          x = np.transpose(x)
      y = self.y.val
      if self.transpose_y.val:
          y = np.transpose(y)
      return np.matmul(x, y)
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/coremltools/converters/mil/mil/ops/defs/linear.py
imports: from coremltools.converters.mil.mil.types.symbolic import is_symbolic
  from ._op_reqs import *
  from ._utils import broadcast_shapes
label_desc: Use image node_id 3 for calling the matmul obj's underlying member method code with example usage: obj.value_inference() and returns: np