fastNLP.core.sampler¶
sampler 子类实现了 fastNLP 所需的各种采样器。
-
class
fastNLP.core.sampler.Sampler[源代码]¶ 别名
fastNLP.SamplerfastNLP.core.sampler.SamplerSampler 类的基类. 规定以何种顺序取出data中的元素
子类必须实现
__call__方法. 输入 DataSet 对象, 返回其中元素的下标序列-
__init__¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
fastNLP.core.sampler.BucketSampler(num_buckets=10, batch_size=None, seq_len_field_name='seq_len')[源代码]¶ -
别名
fastNLP.BucketSamplerfastNLP.core.sampler.BucketSampler带Bucket的 Random Sampler. 可以随机地取出长度相似的元素
-
class
fastNLP.core.sampler.SequentialSampler[源代码]¶ -
别名
fastNLP.SequentialSamplerfastNLP.core.sampler.SequentialSampler顺序取出元素的 Sampler-
__init__¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
fastNLP.core.sampler.RandomSampler[源代码]¶ -
别名
fastNLP.RandomSamplerfastNLP.core.sampler.RandomSampler随机化取元素的 Sampler-
__init__¶ Initialize self. See help(type(self)) for accurate signature.
-