prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  ✨[Converter] Implement aten::addmm
  Torch op:
  func: addmm(Tensor self, Tensor mat1, Tensor mat2, *, Scalar beta=1, Scalar alpha=1) -> Tensor
  Aten op: torch.ops.addmm.default
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `py/torch_tensorrt/dynamo/backend/lowering/_decompositions.py`
  Content:
  ```
  1 import torch
  2 from torch._decomp import register_decomposition, core_aten_decompositions
  3 
  4 
  5 DECOMPOSITIONS = {**core_aten_decompositions()}
  6 
  7 aten = torch.ops.aten
  8 
  9 
  10 def replace_inplace_op(aten_op, outplace_op):
  11     """Replace inplace operation with functional equivalent
  12     Adapted from:
  13     https://github.com/pytorch/pytorch/blob/3344d79e3f732dadd5c85b99a7aa1a022f187929/torch/_decomp/decompositions.py#L3355-L3361
  14     """
  15 
  16     @register_decomposition(aten_op, registry=DECOMPOSITIONS)
  17     def inplace_op(*args, **kwargs):
  18         out = outplace_op(*args, **kwargs)
  19         return args[0].copy_(out)
  20 
  21     return inplace_op
  22 
  23 
  24 replace_inplace_op(aten.add_, aten.add)
  25 replace_inplace_op(aten.addbmm_, aten.addbmm)
  26 replace_inplace_op(aten.addmm_, aten.addmm)
  27 replace_inplace_op(aten.addmv_, aten.addmv)
  28 replace_inplace_op(aten.baddbmm_, aten.baddbmm)
  29 replace_inplace_op(aten.cumprod_, aten.cumprod)
  30 replace_inplace_op(aten.fill_, aten.fill)
  31 replace_inplace_op(aten.gelu_, aten.gelu)
  32 replace_inplace_op(aten.hardsigmoid_, aten.hardsigmoid)
  33 replace_inplace_op(aten.index_put_, aten.index_put)
  34 replace_inplace_op(aten.index_reduce_, aten.index_reduce)
  35 replace_inplace_op(aten.logit_, aten.logit)
  36 replace_inplace_op(aten.relu_, aten.relu)
  37 replace_inplace_op(aten.renorm_, aten.renorm)
  38 replace_inplace_op(aten.round_, aten.round)
  39 replace_inplace_op(aten.scatter_, aten.scatter)
  40 replace_inplace_op(aten.scatter_add_, aten.scatter_add)
  41 replace_inplace_op(aten.scatter_reduce_, aten.scatter_reduce)
  42 
  43 
  44 @register_decomposition(aten.std, registry=DECOMPOSITIONS)
  45 def std_replacement(*args, **kwargs) -> torch.Tensor:
  46     return torch.sqrt(torch.var(*args, **kwargs))
  47 
  48 
  49 @register_decomposition(aten.rsqrt, registry=DECOMPOSITIONS)
  50 def rsqrt_replacement(*args, **kwargs) -> torch.Tensor:
  51     return torch.reciprocal(torch.sqrt(*args, **kwargs))
  52 
  53 
  54 @register_decomposition(aten.alias, registry=DECOMPOSITIONS)
  55 def alias_replacement(x: torch.Tensor) -> torch.Tensor:
  56     return x
  57 
  58 
  59 def get_decompositions():
  60     return DECOMPOSITIONS
  61
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/py/torch_tensorrt/dynamo/backend/lowering/_decompositions.py b/py/torch_tensorrt/dynamo/backend/lowering/_decompositions.py
  --- a/py/torch_tensorrt/dynamo/backend/lowering/_decompositions.py
  +++ b/py/torch_tensorrt/dynamo/backend/lowering/_decompositions.py
  @@ -56,5 +56,14 @@
       return x
   
   
  +@register_decomposition(torch.ops.aten.addmm, registry=DECOMPOSITIONS)
  +def addmm_replacement(
  +    input_: torch.Tensor, mat1: torch.Tensor, mat2: torch.Tensor, *, beta=1, alpha=1
  +) -> torch.Tensor:
  +    return torch.add(
  +        torch.mul(input_, beta), torch.mul(torch.matmul(mat1, mat2), alpha)
  +    )
  +
  +
   def get_decompositions():
       return DECOMPOSITIONS
  
verification_info: {"golden_diff": "diff --git a/py/torch_tensorrt/dynamo/backend/lowering/_decompositions.py b/py/torch_tensorrt/dynamo/backend/lowering/_decompositions.py\n--- a/py/torch_tensorrt/dynamo/backend/lowering/_decompositions.py\n+++ b/py/torch_tensorrt/dynamo/backend/lowering/_decompositions.py\n@@ -56,5 +56,14 @@\n     return x\n \n \n+@register_decomposition(torch.ops.aten.addmm, registry=DECOMPOSITIONS)\n+def addmm_replacement(\n+    input_: torch.Tensor, mat1: torch.Tensor, mat2: torch.Tensor, *, beta=1, alpha=1\n+) -> torch.Tensor:\n+    return torch.add(\n+        torch.mul(input_, beta), torch.mul(torch.matmul(mat1, mat2), alpha)\n+    )\n+\n+\n def get_decompositions():\n     return DECOMPOSITIONS\n", "issue": "\u2728[Converter] Implement aten::addmm\nTorch op:\r\nfunc: addmm(Tensor self, Tensor mat1, Tensor mat2, *, Scalar beta=1, Scalar alpha=1) -> Tensor\r\nAten op: torch.ops.addmm.default\n", "before_files": [{"content": "import torch\nfrom torch._decomp import register_decomposition, core_aten_decompositions\n\n\nDECOMPOSITIONS = {**core_aten_decompositions()}\n\naten = torch.ops.aten\n\n\ndef replace_inplace_op(aten_op, outplace_op):\n    \"\"\"Replace inplace operation with functional equivalent\n    Adapted from:\n    https://github.com/pytorch/pytorch/blob/3344d79e3f732dadd5c85b99a7aa1a022f187929/torch/_decomp/decompositions.py#L3355-L3361\n    \"\"\"\n\n    @register_decomposition(aten_op, registry=DECOMPOSITIONS)\n    def inplace_op(*args, **kwargs):\n        out = outplace_op(*args, **kwargs)\n        return args[0].copy_(out)\n\n    return inplace_op\n\n\nreplace_inplace_op(aten.add_, aten.add)\nreplace_inplace_op(aten.addbmm_, aten.addbmm)\nreplace_inplace_op(aten.addmm_, aten.addmm)\nreplace_inplace_op(aten.addmv_, aten.addmv)\nreplace_inplace_op(aten.baddbmm_, aten.baddbmm)\nreplace_inplace_op(aten.cumprod_, aten.cumprod)\nreplace_inplace_op(aten.fill_, aten.fill)\nreplace_inplace_op(aten.gelu_, aten.gelu)\nreplace_inplace_op(aten.hardsigmoid_, aten.hardsigmoid)\nreplace_inplace_op(aten.index_put_, aten.index_put)\nreplace_inplace_op(aten.index_reduce_, aten.index_reduce)\nreplace_inplace_op(aten.logit_, aten.logit)\nreplace_inplace_op(aten.relu_, aten.relu)\nreplace_inplace_op(aten.renorm_, aten.renorm)\nreplace_inplace_op(aten.round_, aten.round)\nreplace_inplace_op(aten.scatter_, aten.scatter)\nreplace_inplace_op(aten.scatter_add_, aten.scatter_add)\nreplace_inplace_op(aten.scatter_reduce_, aten.scatter_reduce)\n\n\n@register_decomposition(aten.std, registry=DECOMPOSITIONS)\ndef std_replacement(*args, **kwargs) -> torch.Tensor:\n    return torch.sqrt(torch.var(*args, **kwargs))\n\n\n@register_decomposition(aten.rsqrt, registry=DECOMPOSITIONS)\ndef rsqrt_replacement(*args, **kwargs) -> torch.Tensor:\n    return torch.reciprocal(torch.sqrt(*args, **kwargs))\n\n\n@register_decomposition(aten.alias, registry=DECOMPOSITIONS)\ndef alias_replacement(x: torch.Tensor) -> torch.Tensor:\n    return x\n\n\ndef get_decompositions():\n    return DECOMPOSITIONS\n", "path": "py/torch_tensorrt/dynamo/backend/lowering/_decompositions.py"}], "after_files": [{"content": "import torch\nfrom torch._decomp import register_decomposition, core_aten_decompositions\n\n\nDECOMPOSITIONS = {**core_aten_decompositions()}\n\naten = torch.ops.aten\n\n\ndef replace_inplace_op(aten_op, outplace_op):\n    \"\"\"Replace inplace operation with functional equivalent\n    Adapted from:\n    https://github.com/pytorch/pytorch/blob/3344d79e3f732dadd5c85b99a7aa1a022f187929/torch/_decomp/decompositions.py#L3355-L3361\n    \"\"\"\n\n    @register_decomposition(aten_op, registry=DECOMPOSITIONS)\n    def inplace_op(*args, **kwargs):\n        out = outplace_op(*args, **kwargs)\n        return args[0].copy_(out)\n\n    return inplace_op\n\n\nreplace_inplace_op(aten.add_, aten.add)\nreplace_inplace_op(aten.addbmm_, aten.addbmm)\nreplace_inplace_op(aten.addmm_, aten.addmm)\nreplace_inplace_op(aten.addmv_, aten.addmv)\nreplace_inplace_op(aten.baddbmm_, aten.baddbmm)\nreplace_inplace_op(aten.cumprod_, aten.cumprod)\nreplace_inplace_op(aten.fill_, aten.fill)\nreplace_inplace_op(aten.gelu_, aten.gelu)\nreplace_inplace_op(aten.hardsigmoid_, aten.hardsigmoid)\nreplace_inplace_op(aten.index_put_, aten.index_put)\nreplace_inplace_op(aten.index_reduce_, aten.index_reduce)\nreplace_inplace_op(aten.logit_, aten.logit)\nreplace_inplace_op(aten.relu_, aten.relu)\nreplace_inplace_op(aten.renorm_, aten.renorm)\nreplace_inplace_op(aten.round_, aten.round)\nreplace_inplace_op(aten.scatter_, aten.scatter)\nreplace_inplace_op(aten.scatter_add_, aten.scatter_add)\nreplace_inplace_op(aten.scatter_reduce_, aten.scatter_reduce)\n\n\n@register_decomposition(aten.std, registry=DECOMPOSITIONS)\ndef std_replacement(*args, **kwargs) -> torch.Tensor:\n    return torch.sqrt(torch.var(*args, **kwargs))\n\n\n@register_decomposition(aten.rsqrt, registry=DECOMPOSITIONS)\ndef rsqrt_replacement(*args, **kwargs) -> torch.Tensor:\n    return torch.reciprocal(torch.sqrt(*args, **kwargs))\n\n\n@register_decomposition(aten.alias, registry=DECOMPOSITIONS)\ndef alias_replacement(x: torch.Tensor) -> torch.Tensor:\n    return x\n\n\n@register_decomposition(torch.ops.aten.addmm, registry=DECOMPOSITIONS)\ndef addmm_replacement(\n    input_: torch.Tensor, mat1: torch.Tensor, mat2: torch.Tensor, *, beta=1, alpha=1\n) -> torch.Tensor:\n    return torch.add(\n        torch.mul(input_, beta), torch.mul(torch.matmul(mat1, mat2), alpha)\n    )\n\n\ndef get_decompositions():\n    return DECOMPOSITIONS\n", "path": "py/torch_tensorrt/dynamo/backend/lowering/_decompositions.py"}]}