prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  [Example][Bug] Running error on the example case: example/pytorch/dimenet
  ## 🐛 Bug
  
  Dimenet example is crashed. 
  
  ## To Reproduce
  
  `python main.py --model-cnf config/dimenet.yaml`
  
  ```
  Traceback (most recent call last):
    File "main.py", line 254, in <module>
      main()
    File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
      return self.main(*args, **kwargs)
    File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 1053, in main
      rv = self.invoke(ctx)
    File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
      return ctx.invoke(self.callback, **ctx.params)
    File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 754, in invoke
      return __callback(*args, **kwargs)
    File "main.py", line 165, in main
      model = DimeNet(emb_size=model_params['emb_size'],
    File "/workspace/examples/dimenet/modules/dimenet.py", line 64, in __init__
      self.rbf_layer = BesselBasisLayer(num_radial=num_radial,
    File "/workspace/examples/dimenet/modules/bessel_basis_layer.py", line 17, in __init__
      self.reset_params()
    File "/workspace/examples/dimenet/modules/bessel_basis_layer.py", line 20, in reset_params
      torch.arange(1, self.frequencies.numel() + 1, out=self.frequencies).mul_(np.pi)
  RuntimeError: a leaf Variable that requires grad is being used in an in-place operation.
  ```
  
  ## Expected behavior
  
  The case should run through
  
  ## Environment
  
   - DGL Version (e.g., 1.0): 0.9
   - Backend Library & Version (e.g., PyTorch 0.4.1, MXNet/Gluon 1.3): 1.12
   - OS (e.g., Linux): ubuntu
   - How you installed DGL (`conda`, `pip`, source): source
   - Build command you used (if compiling from source):
   - Python version: 3.8
   - CUDA/cuDNN version (if applicable): 11.7
   - GPU models and configuration (e.g. V100): A100
   - Any other relevant information:
  
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `examples/pytorch/dimenet/modules/bessel_basis_layer.py`
  Content:
  ```
  1 import numpy as np
  2 import torch
  3 import torch.nn as nn
  4 
  5 from modules.envelope import Envelope
  6 
  7 class BesselBasisLayer(nn.Module):
  8     def __init__(self,
  9                  num_radial,
  10                  cutoff,
  11                  envelope_exponent=5):
  12         super(BesselBasisLayer, self).__init__()
  13         
  14         self.cutoff = cutoff
  15         self.envelope = Envelope(envelope_exponent)
  16         self.frequencies = nn.Parameter(torch.Tensor(num_radial))
  17         self.reset_params()
  18 
  19     def reset_params(self):
  20         torch.arange(1, self.frequencies.numel() + 1, out=self.frequencies).mul_(np.pi)
  21 
  22     def forward(self, g):
  23         d_scaled = g.edata['d'] / self.cutoff
  24         # Necessary for proper broadcasting behaviour
  25         d_scaled = torch.unsqueeze(d_scaled, -1)
  26         d_cutoff = self.envelope(d_scaled)
  27         g.edata['rbf'] = d_cutoff * torch.sin(self.frequencies * d_scaled)
  28         return g
  ```
  --- 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/examples/pytorch/dimenet/modules/bessel_basis_layer.py b/examples/pytorch/dimenet/modules/bessel_basis_layer.py
  --- a/examples/pytorch/dimenet/modules/bessel_basis_layer.py
  +++ b/examples/pytorch/dimenet/modules/bessel_basis_layer.py
  @@ -17,7 +17,9 @@
           self.reset_params()
   
       def reset_params(self):
  -        torch.arange(1, self.frequencies.numel() + 1, out=self.frequencies).mul_(np.pi)
  +        with torch.no_grad():
  +            torch.arange(1, self.frequencies.numel() + 1, out=self.frequencies).mul_(np.pi)
  +        self.frequencies.requires_grad_()
   
       def forward(self, g):
           d_scaled = g.edata['d'] / self.cutoff
  @@ -25,4 +27,4 @@
           d_scaled = torch.unsqueeze(d_scaled, -1)
           d_cutoff = self.envelope(d_scaled)
           g.edata['rbf'] = d_cutoff * torch.sin(self.frequencies * d_scaled)
  -        return g
  \ No newline at end of file
  +        return g
  
verification_info: {"golden_diff": "diff --git a/examples/pytorch/dimenet/modules/bessel_basis_layer.py b/examples/pytorch/dimenet/modules/bessel_basis_layer.py\n--- a/examples/pytorch/dimenet/modules/bessel_basis_layer.py\n+++ b/examples/pytorch/dimenet/modules/bessel_basis_layer.py\n@@ -17,7 +17,9 @@\n         self.reset_params()\n \n     def reset_params(self):\n-        torch.arange(1, self.frequencies.numel() + 1, out=self.frequencies).mul_(np.pi)\n+        with torch.no_grad():\n+            torch.arange(1, self.frequencies.numel() + 1, out=self.frequencies).mul_(np.pi)\n+        self.frequencies.requires_grad_()\n \n     def forward(self, g):\n         d_scaled = g.edata['d'] / self.cutoff\n@@ -25,4 +27,4 @@\n         d_scaled = torch.unsqueeze(d_scaled, -1)\n         d_cutoff = self.envelope(d_scaled)\n         g.edata['rbf'] = d_cutoff * torch.sin(self.frequencies * d_scaled)\n-        return g\n\\ No newline at end of file\n+        return g\n", "issue": "[Example][Bug] Running error on the example case: example/pytorch/dimenet\n## \ud83d\udc1b Bug\r\n\r\nDimenet example is crashed. \r\n\r\n## To Reproduce\r\n\r\n`python main.py --model-cnf config/dimenet.yaml`\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"main.py\", line 254, in <module>\r\n    main()\r\n  File \"/opt/conda/lib/python3.8/site-packages/click/core.py\", line 1128, in __call__\r\n    return self.main(*args, **kwargs)\r\n  File \"/opt/conda/lib/python3.8/site-packages/click/core.py\", line 1053, in main\r\n    rv = self.invoke(ctx)\r\n  File \"/opt/conda/lib/python3.8/site-packages/click/core.py\", line 1395, in invoke\r\n    return ctx.invoke(self.callback, **ctx.params)\r\n  File \"/opt/conda/lib/python3.8/site-packages/click/core.py\", line 754, in invoke\r\n    return __callback(*args, **kwargs)\r\n  File \"main.py\", line 165, in main\r\n    model = DimeNet(emb_size=model_params['emb_size'],\r\n  File \"/workspace/examples/dimenet/modules/dimenet.py\", line 64, in __init__\r\n    self.rbf_layer = BesselBasisLayer(num_radial=num_radial,\r\n  File \"/workspace/examples/dimenet/modules/bessel_basis_layer.py\", line 17, in __init__\r\n    self.reset_params()\r\n  File \"/workspace/examples/dimenet/modules/bessel_basis_layer.py\", line 20, in reset_params\r\n    torch.arange(1, self.frequencies.numel() + 1, out=self.frequencies).mul_(np.pi)\r\nRuntimeError: a leaf Variable that requires grad is being used in an in-place operation.\r\n```\r\n\r\n## Expected behavior\r\n\r\nThe case should run through\r\n\r\n## Environment\r\n\r\n - DGL Version (e.g., 1.0): 0.9\r\n - Backend Library & Version (e.g., PyTorch 0.4.1, MXNet/Gluon 1.3): 1.12\r\n - OS (e.g., Linux): ubuntu\r\n - How you installed DGL (`conda`, `pip`, source): source\r\n - Build command you used (if compiling from source):\r\n - Python version: 3.8\r\n - CUDA/cuDNN version (if applicable): 11.7\r\n - GPU models and configuration (e.g. V100): A100\r\n - Any other relevant information:\r\n\r\n\n", "before_files": [{"content": "import numpy as np\nimport torch\nimport torch.nn as nn\n\nfrom modules.envelope import Envelope\n\nclass BesselBasisLayer(nn.Module):\n    def __init__(self,\n                 num_radial,\n                 cutoff,\n                 envelope_exponent=5):\n        super(BesselBasisLayer, self).__init__()\n        \n        self.cutoff = cutoff\n        self.envelope = Envelope(envelope_exponent)\n        self.frequencies = nn.Parameter(torch.Tensor(num_radial))\n        self.reset_params()\n\n    def reset_params(self):\n        torch.arange(1, self.frequencies.numel() + 1, out=self.frequencies).mul_(np.pi)\n\n    def forward(self, g):\n        d_scaled = g.edata['d'] / self.cutoff\n        # Necessary for proper broadcasting behaviour\n        d_scaled = torch.unsqueeze(d_scaled, -1)\n        d_cutoff = self.envelope(d_scaled)\n        g.edata['rbf'] = d_cutoff * torch.sin(self.frequencies * d_scaled)\n        return g", "path": "examples/pytorch/dimenet/modules/bessel_basis_layer.py"}], "after_files": [{"content": "import numpy as np\nimport torch\nimport torch.nn as nn\n\nfrom modules.envelope import Envelope\n\nclass BesselBasisLayer(nn.Module):\n    def __init__(self,\n                 num_radial,\n                 cutoff,\n                 envelope_exponent=5):\n        super(BesselBasisLayer, self).__init__()\n        \n        self.cutoff = cutoff\n        self.envelope = Envelope(envelope_exponent)\n        self.frequencies = nn.Parameter(torch.Tensor(num_radial))\n        self.reset_params()\n\n    def reset_params(self):\n        with torch.no_grad():\n            torch.arange(1, self.frequencies.numel() + 1, out=self.frequencies).mul_(np.pi)\n        self.frequencies.requires_grad_()\n\n    def forward(self, g):\n        d_scaled = g.edata['d'] / self.cutoff\n        # Necessary for proper broadcasting behaviour\n        d_scaled = torch.unsqueeze(d_scaled, -1)\n        d_cutoff = self.envelope(d_scaled)\n        g.edata['rbf'] = d_cutoff * torch.sin(self.frequencies * d_scaled)\n        return g\n", "path": "examples/pytorch/dimenet/modules/bessel_basis_layer.py"}]}