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/fx/tracer/_tracer_utils.py`
  Content:
  ```
  1 from typing import List, Union, Any
  2 from ..proxy import ColoProxy, ColoAttribute
  3 import torch
  4 from .meta_patch import meta_patched_function, meta_patched_module
  5 
  6 __all__ = ['is_element_in_list', 'extract_meta']
  7 
  8 
  9 def is_element_in_list(elements: Union[List[Any], Any], list_: List[Any]):
  10     if isinstance(elements, (tuple, list, set)):
  11         for ele in elements:
  12             if ele not in list_:
  13                 return False, ele
  14     else:
  15         if elements not in list_:
  16             return False, elements
  17 
  18     return True, None
  19 
  20 
  21 def extract_meta(*args, **kwargs):
  22 
  23     def _convert(val):
  24         if isinstance(val, ColoProxy):
  25             return val.meta_data
  26         elif isinstance(val, (list, tuple)):
  27             return type(val)([_convert(ele) for ele in val])
  28 
  29         return val
  30 
  31     new_args = [_convert(val) for val in args]
  32     new_kwargs = {k: _convert(v) for k, v in kwargs.items()}
  33     return new_args, new_kwargs
  34 
  35 
  36 def compute_meta_data_for_functions_proxy(target, args, kwargs):
  37     args_metas, kwargs_metas = extract_meta(*args, **kwargs)
  38 
  39     # fetch patched function
  40     if meta_patched_function.has(target):
  41         meta_target = meta_patched_function.get(target)
  42     elif meta_patched_function.has(target.__name__):
  43         meta_target = meta_patched_function.get(target.__name__)
  44     else:
  45         meta_target = target
  46     meta_out = meta_target(*args_metas, **kwargs_metas)
  47     if isinstance(meta_out, torch.Tensor):
  48         meta_out = meta_out.to(device="meta")
  49 
  50     return meta_out
  51
  ```
  --- 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/fx/tracer/_tracer_utils.py b/colossalai/fx/tracer/_tracer_utils.py
  --- a/colossalai/fx/tracer/_tracer_utils.py
  +++ b/colossalai/fx/tracer/_tracer_utils.py
  @@ -1,6 +1,8 @@
  -from typing import List, Union, Any
  -from ..proxy import ColoProxy, ColoAttribute
  +from typing import Any, List, Union
  +
   import torch
  +
  +from ..proxy import ColoAttribute, ColoProxy
   from .meta_patch import meta_patched_function, meta_patched_module
   
   __all__ = ['is_element_in_list', 'extract_meta']
  
verification_info: {"golden_diff": "diff --git a/colossalai/fx/tracer/_tracer_utils.py b/colossalai/fx/tracer/_tracer_utils.py\n--- a/colossalai/fx/tracer/_tracer_utils.py\n+++ b/colossalai/fx/tracer/_tracer_utils.py\n@@ -1,6 +1,8 @@\n-from typing import List, Union, Any\n-from ..proxy import ColoProxy, ColoAttribute\n+from typing import Any, List, Union\n+\n import torch\n+\n+from ..proxy import ColoAttribute, ColoProxy\n from .meta_patch import meta_patched_function, meta_patched_module\n \n __all__ = ['is_element_in_list', 'extract_meta']\n", "issue": "[tensor] fix some unittests\n\n[tensor] fix some unittests\n\n[tensor] fix some unittests\n\n", "before_files": [{"content": "from typing import List, Union, Any\nfrom ..proxy import ColoProxy, ColoAttribute\nimport torch\nfrom .meta_patch import meta_patched_function, meta_patched_module\n\n__all__ = ['is_element_in_list', 'extract_meta']\n\n\ndef is_element_in_list(elements: Union[List[Any], Any], list_: List[Any]):\n    if isinstance(elements, (tuple, list, set)):\n        for ele in elements:\n            if ele not in list_:\n                return False, ele\n    else:\n        if elements not in list_:\n            return False, elements\n\n    return True, None\n\n\ndef extract_meta(*args, **kwargs):\n\n    def _convert(val):\n        if isinstance(val, ColoProxy):\n            return val.meta_data\n        elif isinstance(val, (list, tuple)):\n            return type(val)([_convert(ele) for ele in val])\n\n        return val\n\n    new_args = [_convert(val) for val in args]\n    new_kwargs = {k: _convert(v) for k, v in kwargs.items()}\n    return new_args, new_kwargs\n\n\ndef compute_meta_data_for_functions_proxy(target, args, kwargs):\n    args_metas, kwargs_metas = extract_meta(*args, **kwargs)\n\n    # fetch patched function\n    if meta_patched_function.has(target):\n        meta_target = meta_patched_function.get(target)\n    elif meta_patched_function.has(target.__name__):\n        meta_target = meta_patched_function.get(target.__name__)\n    else:\n        meta_target = target\n    meta_out = meta_target(*args_metas, **kwargs_metas)\n    if isinstance(meta_out, torch.Tensor):\n        meta_out = meta_out.to(device=\"meta\")\n\n    return meta_out\n", "path": "colossalai/fx/tracer/_tracer_utils.py"}], "after_files": [{"content": "from typing import Any, List, Union\n\nimport torch\n\nfrom ..proxy import ColoAttribute, ColoProxy\nfrom .meta_patch import meta_patched_function, meta_patched_module\n\n__all__ = ['is_element_in_list', 'extract_meta']\n\n\ndef is_element_in_list(elements: Union[List[Any], Any], list_: List[Any]):\n    if isinstance(elements, (tuple, list, set)):\n        for ele in elements:\n            if ele not in list_:\n                return False, ele\n    else:\n        if elements not in list_:\n            return False, elements\n\n    return True, None\n\n\ndef extract_meta(*args, **kwargs):\n\n    def _convert(val):\n        if isinstance(val, ColoProxy):\n            return val.meta_data\n        elif isinstance(val, (list, tuple)):\n            return type(val)([_convert(ele) for ele in val])\n\n        return val\n\n    new_args = [_convert(val) for val in args]\n    new_kwargs = {k: _convert(v) for k, v in kwargs.items()}\n    return new_args, new_kwargs\n\n\ndef compute_meta_data_for_functions_proxy(target, args, kwargs):\n    args_metas, kwargs_metas = extract_meta(*args, **kwargs)\n\n    # fetch patched function\n    if meta_patched_function.has(target):\n        meta_target = meta_patched_function.get(target)\n    elif meta_patched_function.has(target.__name__):\n        meta_target = meta_patched_function.get(target.__name__)\n    else:\n        meta_target = target\n    meta_out = meta_target(*args_metas, **kwargs_metas)\n    if isinstance(meta_out, torch.Tensor):\n        meta_out = meta_out.to(device=\"meta\")\n\n    return meta_out\n", "path": "colossalai/fx/tracer/_tracer_utils.py"}]}