2021-12-02 20:06:28 +08:00
|
|
|
|
mindspore.dataset.SubsetRandomSampler
|
|
|
|
|
|
======================================
|
2021-11-27 16:09:05 +08:00
|
|
|
|
|
|
|
|
|
|
.. py:class:: mindspore.dataset.SubsetRandomSampler(indices, num_samples=None)
|
2021-11-23 15:00:48 +08:00
|
|
|
|
|
2022-01-05 16:22:27 +08:00
|
|
|
|
给定样本的索引序列,从序列中随机获取索引对数据集进行采样。
|
2021-11-23 15:00:48 +08:00
|
|
|
|
|
2021-11-27 16:09:05 +08:00
|
|
|
|
**参数:**
|
|
|
|
|
|
|
2022-01-05 16:22:27 +08:00
|
|
|
|
- **indices** (Iterable): 样本索引的序列(除了string类型外的任意Python可迭代对象类型)。
|
|
|
|
|
|
- **num_samples** (int, 可选): 获取的样本数,可用于部分获取采样得到的样本。默认值:None,获取采样到的所有样本。
|
|
|
|
|
|
|
|
|
|
|
|
**异常:**
|
|
|
|
|
|
|
2022-02-14 14:34:37 +08:00
|
|
|
|
- **TypeError** `indices` 的类型不是整数。
|
|
|
|
|
|
- **TypeError** `num_samples` 不是整数值。
|
|
|
|
|
|
- **ValueError** `num_samples` 为负值。
|
2021-11-27 16:09:05 +08:00
|
|
|
|
|
2022-01-19 11:26:42 +08:00
|
|
|
|
.. include:: mindspore.dataset.BuiltinSampler.rst
|