kiwi.models.modules package¶
Submodules¶
kiwi.models.modules.attention module¶
-
class
kiwi.models.modules.attention.
Attention
(scorer)[source]¶ Bases:
torch.nn.modules.module.Module
Generic Attention Implementation. Module computes a convex combination of a set of values based on the fit of their keys with a query.
-
forward
(query, keys, values=None)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
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.
-
kiwi.models.modules.scorer module¶
-
class
kiwi.models.modules.scorer.
MLPScorer
(query_size, key_size, layers=2, nonlinearity=<class 'torch.nn.modules.activation.Tanh'>)[source]¶ Bases:
kiwi.models.modules.scorer.Scorer
Implements a score function based on a Multilayer Perceptron.