From 7a66160d72778f80e74fa84c8d185bba3095af1f Mon Sep 17 00:00:00 2001 From: wawltor Date: Wed, 13 Oct 2021 15:47:12 +0800 Subject: [PATCH] [cherrypick] change paddle.mm api to matmul v2 op (#36374) * change the paddle.mm to matmul_v2 * update the code for the mm * update the document for the mm --- python/paddle/tensor/math.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/python/paddle/tensor/math.py b/python/paddle/tensor/math.py index 14a925ef3e2..f5f0b5ed087 100755 --- a/python/paddle/tensor/math.py +++ b/python/paddle/tensor/math.py @@ -923,8 +923,6 @@ def mm(input, mat2, name=None): nontransposed, the prepended or appended dimension :math:`1` will be removed after matrix multiplication. - This op does not support broadcasting. See paddle.matmul. - Args: input (Tensor): The input tensor which is a Tensor. mat2 (Tensor): The input tensor which is a Tensor. @@ -949,9 +947,7 @@ def mm(input, mat2, name=None): """ if in_dygraph_mode(): - out = _varbase_creator(dtype=input.dtype) - _C_ops.matmul(input, mat2, out) - return out + return _C_ops.matmul_v2(input, mat2) def __check_input(x, y): var_names = {'x': x, 'y': y} @@ -991,7 +987,7 @@ def mm(input, mat2, name=None): helper = LayerHelper('mm', **locals()) out = helper.create_variable_for_type_inference(dtype=input.dtype) helper.append_op( - type='matmul', inputs={'X': input, + type='matmul_v2', inputs={'X': input, 'Y': mat2}, outputs={'Out': out}) return out -- GitLab