onmt.BiEncoder

BiEncoder is a bidirectional Sequencer used for the source language.

netFwd

h_1 => h_2 => h_3 => ... => h_n
 |      |      |             |
 .      .      .             .
 |      |      |             |
h_1 => h_2 => h_3 => ... => h_n
 |      |      |             |
 |      |      |             |
x_1    x_2    x_3           x_n

netBwd

h_1 <= h_2 <= h_3 <= ... <= h_n
 |      |      |             |
 .      .      .             .
 |      |      |             |
h_1 <= h_2 <= h_3 <= ... <= h_n
 |      |      |             |
 |      |      |             |
x_1    x_2    x_3           x_n

Inherits from onmt.Sequencer.

[src]

onmt.BiEncoder(input, rnn, merge)

Create a bi-encoder.

Parameters:

  • input - input neural network.
  • rnn - recurrent template module.
  • merge - fwd/bwd merge operation {"concat", "sum"}

[src]

onmt.BiEncoder.load(pretrained)

Return a new BiEncoder using the serialized data pretrained.

[src]

onmt.BiEncoder:serialize()

Return data to serialize.

Undocumented methods

* onmt.BiEncoder:resetPreallocation() * onmt.BiEncoder:maskPadding() * onmt.BiEncoder:forward(batch) * onmt.BiEncoder:backward(batch, gradStatesOutput, gradContextOutput)