prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  [tensor] fix some unittests
  
  [tensor] fix some unittests
  
  [tensor] fix some unittests
  
  
  </issue>
  <code>
  [start of colossalai/legacy/tensor/tensor_spec.py]
  1 from dataclasses import dataclass
  2 from typing import Optional
  3 
  4 from colossalai.legacy.tensor.distspec import DistPlacementPattern, _DistSpec
  5 from colossalai.legacy.tensor.process_group import ProcessGroup
  6 
  7 from .compute_spec import ComputeSpec
  8 
  9 
  10 @dataclass
  11 class ColoTensorSpec:
  12     """ColoTensorSpec
  13 
  14     A data class for specifications of the `ColoTensor`.
  15     It contains attributes of `ProcessGroup`, `_DistSpec`, `ComputeSpec`.
  16     The latter two attributes are optional. If not set, they are default value is `Replicate()` and `None`.
  17     """
  18 
  19     pg: ProcessGroup
  20     dist_attr: Optional[_DistSpec] = _DistSpec(DistPlacementPattern.REPLICATE)
  21     compute_attr: Optional[ComputeSpec] = None
  22
  [end of colossalai/legacy/tensor/tensor_spec.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/colossalai/legacy/tensor/tensor_spec.py b/colossalai/legacy/tensor/tensor_spec.py
  --- a/colossalai/legacy/tensor/tensor_spec.py
  +++ b/colossalai/legacy/tensor/tensor_spec.py
  @@ -1,4 +1,4 @@
  -from dataclasses import dataclass
  +from dataclasses import dataclass, field
   from typing import Optional
   
   from colossalai.legacy.tensor.distspec import DistPlacementPattern, _DistSpec
  @@ -17,5 +17,5 @@
       """
   
       pg: ProcessGroup
  -    dist_attr: Optional[_DistSpec] = _DistSpec(DistPlacementPattern.REPLICATE)
  +    dist_attr: Optional[_DistSpec] = field(default_factory=lambda: _DistSpec(DistPlacementPattern.REPLICATE))
       compute_attr: Optional[ComputeSpec] = None
  
verification_info: {"golden_diff": "diff --git a/colossalai/legacy/tensor/tensor_spec.py b/colossalai/legacy/tensor/tensor_spec.py\n--- a/colossalai/legacy/tensor/tensor_spec.py\n+++ b/colossalai/legacy/tensor/tensor_spec.py\n@@ -1,4 +1,4 @@\n-from dataclasses import dataclass\n+from dataclasses import dataclass, field\n from typing import Optional\n \n from colossalai.legacy.tensor.distspec import DistPlacementPattern, _DistSpec\n@@ -17,5 +17,5 @@\n     \"\"\"\n \n     pg: ProcessGroup\n-    dist_attr: Optional[_DistSpec] = _DistSpec(DistPlacementPattern.REPLICATE)\n+    dist_attr: Optional[_DistSpec] = field(default_factory=lambda: _DistSpec(DistPlacementPattern.REPLICATE))\n     compute_attr: Optional[ComputeSpec] = None\n", "issue": "[tensor] fix some unittests\n\n[tensor] fix some unittests\n\n[tensor] fix some unittests\n\n", "before_files": [{"content": "from dataclasses import dataclass\nfrom typing import Optional\n\nfrom colossalai.legacy.tensor.distspec import DistPlacementPattern, _DistSpec\nfrom colossalai.legacy.tensor.process_group import ProcessGroup\n\nfrom .compute_spec import ComputeSpec\n\n\n@dataclass\nclass ColoTensorSpec:\n    \"\"\"ColoTensorSpec\n\n    A data class for specifications of the `ColoTensor`.\n    It contains attributes of `ProcessGroup`, `_DistSpec`, `ComputeSpec`.\n    The latter two attributes are optional. If not set, they are default value is `Replicate()` and `None`.\n    \"\"\"\n\n    pg: ProcessGroup\n    dist_attr: Optional[_DistSpec] = _DistSpec(DistPlacementPattern.REPLICATE)\n    compute_attr: Optional[ComputeSpec] = None\n", "path": "colossalai/legacy/tensor/tensor_spec.py"}]}