diff --git a/fastNLP/core/dataset.py b/fastNLP/core/dataset.py index d527bf76..7228842f 100644 --- a/fastNLP/core/dataset.py +++ b/fastNLP/core/dataset.py @@ -58,7 +58,10 @@ 2 DataSet与预处理 常见的预处理有如下几种 -2.1 从某个文本文件读取内容 # TODO 引用DataLoader +2.1 从某个文本文件读取内容 # + + .. todo:: + 引用DataLoader Example:: diff --git a/fastNLP/core/losses.py b/fastNLP/core/losses.py index ac08b46f..7a5fdf9d 100644 --- a/fastNLP/core/losses.py +++ b/fastNLP/core/losses.py @@ -221,8 +221,7 @@ class CrossEntropyLoss(LossBase): """ def __init__(self, pred=None, target=None, padding_idx=-100): - # TODO 需要做一些检查,F.cross_entropy在计算时,如果pred是(16, 10 ,4), target的形状按道理应该是(16, 10), 但实际却需要 - # TODO (16, 4) + # TODO 需要做一些检查,F.cross_entropy在计算时,如果pred是(16, 10 ,4), target的形状按道理应该是(16, 10), 但实际需要(16,4) super(CrossEntropyLoss, self).__init__() self._init_param_map(pred=pred, target=target) self.padding_idx = padding_idx diff --git a/fastNLP/io/base_loader.py b/fastNLP/io/base_loader.py index 569f7e2e..051de281 100644 --- a/fastNLP/io/base_loader.py +++ b/fastNLP/io/base_loader.py @@ -47,7 +47,6 @@ class BaseLoader(object): class DataLoaderRegister: - # TODO 这个类使用在何处? _readers = {} @classmethod @@ -64,3 +63,5 @@ class DataLoaderRegister: if read_fn_name in cls._readers: return cls._readers[read_fn_name] raise AttributeError('no read function: {}'.format(read_fn_name)) + + # TODO 这个类使用在何处? diff --git a/fastNLP/modules/aggregator/attention.py b/fastNLP/modules/aggregator/attention.py index 233dcb55..cea9c405 100644 --- a/fastNLP/modules/aggregator/attention.py +++ b/fastNLP/modules/aggregator/attention.py @@ -12,7 +12,8 @@ from ..utils import initial_parameter class DotAttention(nn.Module): """ - TODO + .. todo:: + 补上文档 """ def __init__(self, key_size, value_size, dropout=0): super(DotAttention, self).__init__() diff --git a/fastNLP/modules/utils.py b/fastNLP/modules/utils.py index 78851587..047ebb78 100644 --- a/fastNLP/modules/utils.py +++ b/fastNLP/modules/utils.py @@ -70,7 +70,10 @@ def initial_parameter(net, initial_method=None): def get_embeddings(init_embed): """ - 得到词嵌入 TODO + 得到词嵌入 + + .. todo:: + 补上文档 :param init_embed: 单词词典, 可以是 tuple, 包括(num_embedings, embedding_dim), 即 embedding的大小和每个词的维度. 也可以传入 nn.Embedding 对象,