模块

组合不同的模组,针对不同的任务进行处理。

Biaffine CRF

class BiaffineCRF(input_size, label_num, dropout=0.2, hidden_size=None, **kwargs)[源代码]

基类:ltp.modules.Module

forward(inputs, length, gold=None)[源代码]

Defines the computation performed at every call.

Should be overridden by all subclasses.

注解

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Graph

class Graph(input_size, label_num, dropout, arc_hidden_size, rel_hidden_size, **kwargs)[源代码]

基类:ltp.modules.Module

forward(embedding, seq_lens=None, gold=None)[源代码]

Defines the computation performed at every call.

Should be overridden by all subclasses.

注解

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.