8000 [Ez][BE]: Remove accidental classvar (#153540) · pytorch/pytorch@e0dece5 · GitHub
[go: up one dir, main page]

Skip to content

Commit e0dece5

Browse files
Skylion007pytorchmergebot
authored andcommitted
[Ez][BE]: Remove accidental classvar (#153540)
Untyped variables become ClassVar in dataclasses, this type alias should just be a type alias; no need for it to eb a classvar. Pull Request resolved: #153540 Approved by: https://github.com/albanD, https://github.com/aorenste
1 parent 7412b33 commit e0dece5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

torch/distributed/_shard/sharding_spec/chunk_sharding_spec.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# mypy: allow-untyped-defs
22
from dataclasses import dataclass
33
from typing import cast, Optional, TYPE_CHECKING, Union
4+
from typing_extensions import TypeAlias
45

56
import torch
67
import torch.distributed as dist
@@ -22,6 +23,8 @@
2223
# from run-time to resolve circular dependency.
2324
from torch.distributed._shard.sharded_tensor import ShardedTensor
2425

26+
_ShardingDim: TypeAlias = Union[int, str]
27+
2528

2629
@dataclass
2730
class ChunkShardingSpec(ShardingSpec):
@@ -50,9 +53,7 @@ class ChunkShardingSpec(ShardingSpec):
5053
:class:`torch.distributed._remote_device`
5154
"""
5255

53-
ShardingDim = Union[int, str]
54-
55-
dim: ShardingDim
56+
dim: _ShardingDim
5657
placements: list[Union[torch.distributed._remote_device, str]]
5758

5859
def __post_init__(self):

0 commit comments

Comments
 (0)
0