2021-12-04 19:03:07 +08:00
|
|
|
.. py:method:: add_sampler(new_sampler)
|
2021-12-02 14:16:26 +08:00
|
|
|
|
2021-12-04 20:36:47 +08:00
|
|
|
为当前数据集添加采样器。
|
2021-12-02 14:16:26 +08:00
|
|
|
|
2021-12-04 20:36:47 +08:00
|
|
|
**参数:**
|
2021-12-02 14:16:26 +08:00
|
|
|
|
2021-12-04 20:36:47 +08:00
|
|
|
- **new_sampler** (Sampler) :作用于当前数据集的采样器。
|
2021-12-02 14:16:26 +08:00
|
|
|
|
2021-12-04 20:36:47 +08:00
|
|
|
**样例:**
|
|
|
|
|
|
|
|
|
|
>>> # dataset为任意数据集实例
|
|
|
|
|
>>> # 对该数据集应用DistributedSampler
|
|
|
|
|
>>> new_sampler = ds.DistributedSampler(10, 2)
|
|
|
|
|
>>> dataset.add_sampler(new_sampler)
|