2022-11-08 09:03:50 +00:00
|
|
|
from dataclasses import dataclass
|
2022-06-23 09:34:59 +00:00
|
|
|
from typing import Optional
|
2022-11-08 09:03:50 +00:00
|
|
|
|
|
|
|
from colossalai.tensor.distspec import DistPlacementPattern, _DistSpec
|
|
|
|
from colossalai.tensor.process_group import ProcessGroup
|
|
|
|
|
2022-07-06 08:15:16 +00:00
|
|
|
from .compute_spec import ComputeSpec
|
2022-06-21 07:38:05 +00:00
|
|
|
|
2022-04-28 02:55:40 +00:00
|
|
|
|
2022-07-06 08:15:16 +00:00
|
|
|
@dataclass
|
|
|
|
class ColoTensorSpec:
|
2022-08-16 01:21:05 +00:00
|
|
|
""" ColoTensorSpec
|
2022-11-08 09:03:50 +00:00
|
|
|
|
2022-08-16 01:21:05 +00:00
|
|
|
A data class for specifications of the `ColoTensor`.
|
|
|
|
It contains attributes of `ProcessGroup`, `_DistSpec`, `ComputeSpec`.
|
|
|
|
The latter two attributes are optional. If not set, they are default value is `Replicate()` and `None`.
|
|
|
|
"""
|
2022-07-06 08:15:16 +00:00
|
|
|
pg: ProcessGroup
|
|
|
|
dist_attr: Optional[_DistSpec] = _DistSpec(DistPlacementPattern.REPLICATE)
|
|
|
|
compute_attr: Optional[ComputeSpec] = None
|