prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  [tensor] fix some unittests
  
  [tensor] fix some unittests
  
  [tensor] fix some unittests
  
  [BUG]: Testing failed due to triton
  ### 🐛 Describe the bug
  
  The build on PR workflow failed with the following errors:
  
  <img width="1509" alt="Screenshot 2023-02-07 at 10 30 17" src="https://user-images.githubusercontent.com/31818963/217132926-fd6cffa1-2c4b-46aa-a6cc-1a3d10918411.png">
  
  
  ### Environment
  
  _No response_
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `colossalai/amp/apex_amp/apex_amp.py`
  Content:
  ```
  1 #!/usr/bin/env python
  2 # -*- encoding: utf-8 -*-
  3 
  4 import torch.nn as nn
  5 try:
  6     import apex.amp as apex_amp
  7 except ImportError:
  8     pass
  9 
  10 from torch import Tensor
  11 
  12 from colossalai.nn.optimizer import ColossalaiOptimizer
  13 from colossalai.utils import clip_grad_norm_fp32
  14 
  15 
  16 class ApexAMPOptimizer(ColossalaiOptimizer):
  17     """ A wrapper class for APEX optimizer and it implements apex-specific backward and clip_grad_norm
  18     methods
  19     """
  20 
  21     def backward(self, loss: Tensor):
  22         """Backward pass to get all gradients
  23 
  24         Args:
  25             loss (torch.Tensor): Loss computed by a loss function
  26         """
  27         with apex_amp.scale_loss(loss, self.optim) as scaled_loss:
  28             scaled_loss.backward()
  29 
  30     def clip_grad_norm(self, model: nn.Module, max_norm: float):
  31         """Clip gradients by norm
  32 
  33         Args:
  34             model (torch.nn.Module): Your model object
  35             max_norm (float): The max norm value for gradient clipping
  36         """
  37         if max_norm > 0:
  38             clip_grad_norm_fp32(apex_amp.master_params(self.optim), max_norm)
  39
  ```
  --- 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/colossalai/amp/apex_amp/apex_amp.py b/colossalai/amp/apex_amp/apex_amp.py
  --- a/colossalai/amp/apex_amp/apex_amp.py
  +++ b/colossalai/amp/apex_amp/apex_amp.py
  @@ -2,6 +2,7 @@
   # -*- encoding: utf-8 -*-
   
   import torch.nn as nn
  +
   try:
       import apex.amp as apex_amp
   except ImportError:
  
verification_info: {"golden_diff": "diff --git a/colossalai/amp/apex_amp/apex_amp.py b/colossalai/amp/apex_amp/apex_amp.py\n--- a/colossalai/amp/apex_amp/apex_amp.py\n+++ b/colossalai/amp/apex_amp/apex_amp.py\n@@ -2,6 +2,7 @@\n # -*- encoding: utf-8 -*-\n \n import torch.nn as nn\n+\n try:\n     import apex.amp as apex_amp\n except ImportError:\n", "issue": "[tensor] fix some unittests\n\n[tensor] fix some unittests\n\n[tensor] fix some unittests\n\n[BUG]: Testing failed due to triton\n### \ud83d\udc1b Describe the bug\n\nThe build on PR workflow failed with the following errors:\r\n\r\n<img width=\"1509\" alt=\"Screenshot 2023-02-07 at 10 30 17\" src=\"https://user-images.githubusercontent.com/31818963/217132926-fd6cffa1-2c4b-46aa-a6cc-1a3d10918411.png\">\r\n\n\n### Environment\n\n_No response_\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- encoding: utf-8 -*-\n\nimport torch.nn as nn\ntry:\n    import apex.amp as apex_amp\nexcept ImportError:\n    pass\n\nfrom torch import Tensor\n\nfrom colossalai.nn.optimizer import ColossalaiOptimizer\nfrom colossalai.utils import clip_grad_norm_fp32\n\n\nclass ApexAMPOptimizer(ColossalaiOptimizer):\n    \"\"\" A wrapper class for APEX optimizer and it implements apex-specific backward and clip_grad_norm\n    methods\n    \"\"\"\n\n    def backward(self, loss: Tensor):\n        \"\"\"Backward pass to get all gradients\n\n        Args:\n            loss (torch.Tensor): Loss computed by a loss function\n        \"\"\"\n        with apex_amp.scale_loss(loss, self.optim) as scaled_loss:\n            scaled_loss.backward()\n\n    def clip_grad_norm(self, model: nn.Module, max_norm: float):\n        \"\"\"Clip gradients by norm\n\n        Args:\n            model (torch.nn.Module): Your model object\n            max_norm (float): The max norm value for gradient clipping\n        \"\"\"\n        if max_norm > 0:\n            clip_grad_norm_fp32(apex_amp.master_params(self.optim), max_norm)\n", "path": "colossalai/amp/apex_amp/apex_amp.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- encoding: utf-8 -*-\n\nimport torch.nn as nn\n\ntry:\n    import apex.amp as apex_amp\nexcept ImportError:\n    pass\n\nfrom torch import Tensor\n\nfrom colossalai.nn.optimizer import ColossalaiOptimizer\nfrom colossalai.utils import clip_grad_norm_fp32\n\n\nclass ApexAMPOptimizer(ColossalaiOptimizer):\n    \"\"\" A wrapper class for APEX optimizer and it implements apex-specific backward and clip_grad_norm\n    methods\n    \"\"\"\n\n    def backward(self, loss: Tensor):\n        \"\"\"Backward pass to get all gradients\n\n        Args:\n            loss (torch.Tensor): Loss computed by a loss function\n        \"\"\"\n        with apex_amp.scale_loss(loss, self.optim) as scaled_loss:\n            scaled_loss.backward()\n\n    def clip_grad_norm(self, model: nn.Module, max_norm: float):\n        \"\"\"Clip gradients by norm\n\n        Args:\n            model (torch.nn.Module): Your model object\n            max_norm (float): The max norm value for gradient clipping\n        \"\"\"\n        if max_norm > 0:\n            clip_grad_norm_fp32(apex_amp.master_params(self.optim), max_norm)\n", "path": "colossalai/amp/apex_amp/apex_amp.py"}]}