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
  
  
  --- 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/gemini/gemini_context.py`
  Content:
  ```
  1 from enum import EnumMeta
  2 
  3 
  4 class GeminiMemoryManager(object):
  5 
  6     def __init__(self, states_cls: EnumMeta):
  7         super().__init__()
  8         self.states_cls = states_cls
  9         self._cnter = 0    # the counter of instances
  10 
  11         self.total_mem = dict()
  12         self.state_mem = dict()
  13         self.state_mem['cpu'] = dict()
  14         self.state_mem['cuda'] = dict()
  15 
  16         self.reset()
  17 
  18     @property
  19     def total_number(self):
  20         return self._cnter
  21 
  22     def reset(self):
  23         self._cnter = 0    # the counter of instances
  24 
  25         self.total_mem['cpu'] = 0    # memory occupation of instances in cpu
  26         self.total_mem['cuda'] = 0    # memory of occupation of instances in cuda
  27 
  28         # memory conditions for all states
  29         for state in self.states_cls:
  30             self.state_mem['cpu'][state] = 0
  31             self.state_mem['cuda'][state] = 0
  32 
  33     def register_new_instance(self):
  34         self._cnter += 1
  35 
  36     def delete_instance(self):
  37         self._cnter -= 1
  38 
  39     def print_info(self):
  40         print(f"Total number: {self.total_number}",
  41               f"Total CPU memory occupation: {self.total_mem['cpu']}",
  42               f"Total CUDA memory occupation: {self.total_mem['cuda']}\n",
  43               sep='\n')
  44 
  45         for state in self.states_cls:
  46             print(f"{state}: CPU memory occupation: {self.state_mem['cpu'][state]}",
  47                   f"{state}: CUDA memory occupation: {self.state_mem['cuda'][state]}\n",
  48                   sep='\n')
  49
  ```
  --- 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/gemini/gemini_context.py b/colossalai/gemini/gemini_context.py
  --- a/colossalai/gemini/gemini_context.py
  +++ b/colossalai/gemini/gemini_context.py
  @@ -1,48 +1,48 @@
  -from enum import EnumMeta
  -
  -
  -class GeminiMemoryManager(object):
  -
  -    def __init__(self, states_cls: EnumMeta):
  -        super().__init__()
  -        self.states_cls = states_cls
  -        self._cnter = 0    # the counter of instances
  -
  -        self.total_mem = dict()
  -        self.state_mem = dict()
  -        self.state_mem['cpu'] = dict()
  -        self.state_mem['cuda'] = dict()
  -
  -        self.reset()
  -
  -    @property
  -    def total_number(self):
  -        return self._cnter
  -
  -    def reset(self):
  -        self._cnter = 0    # the counter of instances
  -
  -        self.total_mem['cpu'] = 0    # memory occupation of instances in cpu
  -        self.total_mem['cuda'] = 0    # memory of occupation of instances in cuda
  -
  -        # memory conditions for all states
  -        for state in self.states_cls:
  -            self.state_mem['cpu'][state] = 0
  -            self.state_mem['cuda'][state] = 0
  -
  -    def register_new_instance(self):
  -        self._cnter += 1
  -
  -    def delete_instance(self):
  -        self._cnter -= 1
  -
  -    def print_info(self):
  -        print(f"Total number: {self.total_number}",
  -              f"Total CPU memory occupation: {self.total_mem['cpu']}",
  -              f"Total CUDA memory occupation: {self.total_mem['cuda']}\n",
  -              sep='\n')
  -
  -        for state in self.states_cls:
  -            print(f"{state}: CPU memory occupation: {self.state_mem['cpu'][state]}",
  -                  f"{state}: CUDA memory occupation: {self.state_mem['cuda'][state]}\n",
  -                  sep='\n')
  +from enum import EnumMeta
  +
  +
  +class GeminiMemoryManager(object):
  +
  +    def __init__(self, states_cls: EnumMeta):
  +        super().__init__()
  +        self.states_cls = states_cls
  +        self._cnter = 0    # the counter of instances
  +
  +        self.total_mem = dict()
  +        self.state_mem = dict()
  +        self.state_mem['cpu'] = dict()
  +        self.state_mem['cuda'] = dict()
  +
  +        self.reset()
  +
  +    @property
  +    def total_number(self):
  +        return self._cnter
  +
  +    def reset(self):
  +        self._cnter = 0    # the counter of instances
  +
  +        self.total_mem['cpu'] = 0    # memory occupation of instances in cpu
  +        self.total_mem['cuda'] = 0    # memory of occupation of instances in cuda
  +
  +        # memory conditions for all states
  +        for state in self.states_cls:
  +            self.state_mem['cpu'][state] = 0
  +            self.state_mem['cuda'][state] = 0
  +
  +    def register_new_instance(self):
  +        self._cnter += 1
  +
  +    def delete_instance(self):
  +        self._cnter -= 1
  +
  +    def print_info(self):
  +        print(f"Total number: {self.total_number}",
  +              f"Total CPU memory occupation: {self.total_mem['cpu']}",
  +              f"Total CUDA memory occupation: {self.total_mem['cuda']}\n",
  +              sep='\n')
  +
  +        for state in self.states_cls:
  +            print(f"{state}: CPU memory occupation: {self.state_mem['cpu'][state]}",
  +                  f"{state}: CUDA memory occupation: {self.state_mem['cuda'][state]}\n",
  +                  sep='\n')
  
verification_info: {"golden_diff": "diff --git a/colossalai/gemini/gemini_context.py b/colossalai/gemini/gemini_context.py\n--- a/colossalai/gemini/gemini_context.py\n+++ b/colossalai/gemini/gemini_context.py\n@@ -1,48 +1,48 @@\n-from enum import EnumMeta\r\n-\r\n-\r\n-class GeminiMemoryManager(object):\r\n-\r\n-    def __init__(self, states_cls: EnumMeta):\r\n-        super().__init__()\r\n-        self.states_cls = states_cls\r\n-        self._cnter = 0    # the counter of instances\r\n-\r\n-        self.total_mem = dict()\r\n-        self.state_mem = dict()\r\n-        self.state_mem['cpu'] = dict()\r\n-        self.state_mem['cuda'] = dict()\r\n-\r\n-        self.reset()\r\n-\r\n-    @property\r\n-    def total_number(self):\r\n-        return self._cnter\r\n-\r\n-    def reset(self):\r\n-        self._cnter = 0    # the counter of instances\r\n-\r\n-        self.total_mem['cpu'] = 0    # memory occupation of instances in cpu\r\n-        self.total_mem['cuda'] = 0    # memory of occupation of instances in cuda\r\n-\r\n-        # memory conditions for all states\r\n-        for state in self.states_cls:\r\n-            self.state_mem['cpu'][state] = 0\r\n-            self.state_mem['cuda'][state] = 0\r\n-\r\n-    def register_new_instance(self):\r\n-        self._cnter += 1\r\n-\r\n-    def delete_instance(self):\r\n-        self._cnter -= 1\r\n-\r\n-    def print_info(self):\r\n-        print(f\"Total number: {self.total_number}\",\r\n-              f\"Total CPU memory occupation: {self.total_mem['cpu']}\",\r\n-              f\"Total CUDA memory occupation: {self.total_mem['cuda']}\\n\",\r\n-              sep='\\n')\r\n-\r\n-        for state in self.states_cls:\r\n-            print(f\"{state}: CPU memory occupation: {self.state_mem['cpu'][state]}\",\r\n-                  f\"{state}: CUDA memory occupation: {self.state_mem['cuda'][state]}\\n\",\r\n-                  sep='\\n')\r\n+from enum import EnumMeta\n+\n+\n+class GeminiMemoryManager(object):\n+\n+    def __init__(self, states_cls: EnumMeta):\n+        super().__init__()\n+        self.states_cls = states_cls\n+        self._cnter = 0    # the counter of instances\n+\n+        self.total_mem = dict()\n+        self.state_mem = dict()\n+        self.state_mem['cpu'] = dict()\n+        self.state_mem['cuda'] = dict()\n+\n+        self.reset()\n+\n+    @property\n+    def total_number(self):\n+        return self._cnter\n+\n+    def reset(self):\n+        self._cnter = 0    # the counter of instances\n+\n+        self.total_mem['cpu'] = 0    # memory occupation of instances in cpu\n+        self.total_mem['cuda'] = 0    # memory of occupation of instances in cuda\n+\n+        # memory conditions for all states\n+        for state in self.states_cls:\n+            self.state_mem['cpu'][state] = 0\n+            self.state_mem['cuda'][state] = 0\n+\n+    def register_new_instance(self):\n+        self._cnter += 1\n+\n+    def delete_instance(self):\n+        self._cnter -= 1\n+\n+    def print_info(self):\n+        print(f\"Total number: {self.total_number}\",\n+              f\"Total CPU memory occupation: {self.total_mem['cpu']}\",\n+              f\"Total CUDA memory occupation: {self.total_mem['cuda']}\\n\",\n+              sep='\\n')\n+\n+        for state in self.states_cls:\n+            print(f\"{state}: CPU memory occupation: {self.state_mem['cpu'][state]}\",\n+                  f\"{state}: CUDA memory occupation: {self.state_mem['cuda'][state]}\\n\",\n+                  sep='\\n')\n", "issue": "[tensor] fix some unittests\n\n[tensor] fix some unittests\n\n[tensor] fix some unittests\n\n", "before_files": [{"content": "from enum import EnumMeta\r\n\r\n\r\nclass GeminiMemoryManager(object):\r\n\r\n    def __init__(self, states_cls: EnumMeta):\r\n        super().__init__()\r\n        self.states_cls = states_cls\r\n        self._cnter = 0    # the counter of instances\r\n\r\n        self.total_mem = dict()\r\n        self.state_mem = dict()\r\n        self.state_mem['cpu'] = dict()\r\n        self.state_mem['cuda'] = dict()\r\n\r\n        self.reset()\r\n\r\n    @property\r\n    def total_number(self):\r\n        return self._cnter\r\n\r\n    def reset(self):\r\n        self._cnter = 0    # the counter of instances\r\n\r\n        self.total_mem['cpu'] = 0    # memory occupation of instances in cpu\r\n        self.total_mem['cuda'] = 0    # memory of occupation of instances in cuda\r\n\r\n        # memory conditions for all states\r\n        for state in self.states_cls:\r\n            self.state_mem['cpu'][state] = 0\r\n            self.state_mem['cuda'][state] = 0\r\n\r\n    def register_new_instance(self):\r\n        self._cnter += 1\r\n\r\n    def delete_instance(self):\r\n        self._cnter -= 1\r\n\r\n    def print_info(self):\r\n        print(f\"Total number: {self.total_number}\",\r\n              f\"Total CPU memory occupation: {self.total_mem['cpu']}\",\r\n              f\"Total CUDA memory occupation: {self.total_mem['cuda']}\\n\",\r\n              sep='\\n')\r\n\r\n        for state in self.states_cls:\r\n            print(f\"{state}: CPU memory occupation: {self.state_mem['cpu'][state]}\",\r\n                  f\"{state}: CUDA memory occupation: {self.state_mem['cuda'][state]}\\n\",\r\n                  sep='\\n')\r\n", "path": "colossalai/gemini/gemini_context.py"}], "after_files": [{"content": "from enum import EnumMeta\n\n\nclass GeminiMemoryManager(object):\n\n    def __init__(self, states_cls: EnumMeta):\n        super().__init__()\n        self.states_cls = states_cls\n        self._cnter = 0    # the counter of instances\n\n        self.total_mem = dict()\n        self.state_mem = dict()\n        self.state_mem['cpu'] = dict()\n        self.state_mem['cuda'] = dict()\n\n        self.reset()\n\n    @property\n    def total_number(self):\n        return self._cnter\n\n    def reset(self):\n        self._cnter = 0    # the counter of instances\n\n        self.total_mem['cpu'] = 0    # memory occupation of instances in cpu\n        self.total_mem['cuda'] = 0    # memory of occupation of instances in cuda\n\n        # memory conditions for all states\n        for state in self.states_cls:\n            self.state_mem['cpu'][state] = 0\n            self.state_mem['cuda'][state] = 0\n\n    def register_new_instance(self):\n        self._cnter += 1\n\n    def delete_instance(self):\n        self._cnter -= 1\n\n    def print_info(self):\n        print(f\"Total number: {self.total_number}\",\n              f\"Total CPU memory occupation: {self.total_mem['cpu']}\",\n              f\"Total CUDA memory occupation: {self.total_mem['cuda']}\\n\",\n              sep='\\n')\n\n        for state in self.states_cls:\n            print(f\"{state}: CPU memory occupation: {self.state_mem['cpu'][state]}\",\n                  f\"{state}: CUDA memory occupation: {self.state_mem['cuda'][state]}\\n\",\n                  sep='\\n')\n", "path": "colossalai/gemini/gemini_context.py"}]}