SubsetRandomSampler¶
- class paddle.io. SubsetRandomSampler ( indices ) [source]
-
Randomly sample elements from a given list of indices, without replacement.
- Parameters
-
indices (sequence) – a sequence of indices
Examples
>>> import paddle >>> from paddle.io import SubsetRandomSampler >>> paddle.seed(2023) >>> sampler = SubsetRandomSampler(indices=[1, 3, 5, 7, 9]) >>> for index in sampler: ... print(index) 9 3 7 5 1