mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: I haven't had a chance to rigorously try these out yet so don't merge yet. Closes #18725. Pull Request resolved: https://github.com/pytorch/pytorch/pull/18963 Differential Revision: D14832897 Pulled By: ezyang fbshipit-source-id: 4780e7a34126bc66ddbfd9d808dfc9e0edd77e68
25 lines
886 B
Python
25 lines
886 B
Python
from typing import Iterator, Optional, Sequence, List, TypeVar, Generic, Sized
|
|
|
|
T_co = TypeVar('T_co', covariant=True)
|
|
class Sampler(Generic[T_co]):
|
|
def __init__(self, data_source: Sized) -> None: ...
|
|
def __iter__(self) -> Iterator[T_co]: ...
|
|
def __len__(self) -> int: ...
|
|
|
|
class SequentialSampler(Sampler[int]):
|
|
pass
|
|
|
|
class RandomSampler(Sampler[int]):
|
|
num_samples: int
|
|
|
|
def __init__(self, data_source: Sized, replacement: bool=..., num_samples: Optional[int]=...) -> None: ...
|
|
|
|
class SubsetRandomSampler(Sampler[int]):
|
|
def __init__(self, indices: Sequence[int]) -> None: ...
|
|
|
|
class WeightedRandomSampler(Sampler[int]):
|
|
def __init__(self, weights: Sequence[float], num_samples: int, replacement: bool=...) -> None: ...
|
|
|
|
class BatchSampler(Sampler[List[int]]):
|
|
def __init__(self, sampler: Sampler[int], batch_size: int, drop_last: bool) -> None: ...
|