mirror of
https://github.com/pytorch/pytorch.git
synced 2025-11-03 07:24:58 +08:00
[BE][Easy] Fix PYI001: unprefixed-type-param in torch/utils/data/datapipes (#129885)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/129885 Approved by: https://github.com/ezyang
This commit is contained in:
committed by
PyTorch MergeBot
parent
257b9c7936
commit
f1df13f023
@ -9,10 +9,11 @@ from torch.utils.data.sampler import Sampler
|
||||
|
||||
__all__ = ["DistributedSampler"]
|
||||
|
||||
T_co = TypeVar("T_co", covariant=True)
|
||||
|
||||
_T_co = TypeVar("_T_co", covariant=True)
|
||||
|
||||
|
||||
class DistributedSampler(Sampler[T_co]):
|
||||
class DistributedSampler(Sampler[_T_co]):
|
||||
r"""Sampler that restricts data loading to a subset of the dataset.
|
||||
|
||||
It is especially useful in conjunction with
|
||||
@ -102,7 +103,7 @@ class DistributedSampler(Sampler[T_co]):
|
||||
self.shuffle = shuffle
|
||||
self.seed = seed
|
||||
|
||||
def __iter__(self) -> Iterator[T_co]:
|
||||
def __iter__(self) -> Iterator[_T_co]:
|
||||
if self.shuffle:
|
||||
# deterministically shuffle based on epoch and seed
|
||||
g = torch.Generator()
|
||||
|
||||
Reference in New Issue
Block a user