paddle. addmm ( input, x, y, beta=1.0, alpha=1.0, name=None ) [source]


This operator is used to perform matrix multiplication for input $x$ and $y$. $input$ is added to the final result. The equation is:

\[Out = alpha * x * y + beta * input\]

$Input$, $x$ and $y$ can carry the LoD (Level of Details) information, or not. But the output only shares the LoD information with input $input$.

  • input (Tensor) – The input Tensor to be added to the final result.

  • x (Tensor) – The first input Tensor for matrix multiplication.

  • y (Tensor) – The second input Tensor for matrix multiplication.

  • beta (float) – Coefficient of $input$.

  • alpha (float) – Coefficient of $x*y$.

  • name (str, optional) – Name of the output. Normally there is no need for user to set this property. For more information, please refer to Name. Default is None.


The output Tensor of addmm op.

Return type



import paddle

x = paddle.ones([2,2])
y = paddle.ones([2,2])
input = paddle.ones([2,2])

out = paddle.addmm( input=input, x=x, y=y, beta=0.5, alpha=5.0 )

# [[10.5 10.5]
# [10.5 10.5]]