OpenNMT Forum

Decoder's input

Hello,

I need some precision about what a decoder (such as the SelfAttention one) is taking in input, in your example your wrote

Here your give target_embedding as inputs for your decoder.decode() and the memory parameter is containing the output of the encoder, which is optional

Could you explain why the memory parameter is not mandatory, don’t we always need something to be decoded ?

And why the inputs parameter is mandatory, because it contains the target sentence embeddings and sometimes you don’t have a target sentence (at translation time for example) ?

Thanks

Hi,

Could you explain why the memory parameter is not mandatory, don’t we always need something to be decoded ?

Decoders can be used for language modelling where memory does not exist.

And why the inputs parameter is mandatory, because it contains the target sentence embeddings and sometimes you don’t have a target sentence (at translation time for example) ?

The decode method expects the full target sequence and is used for training. The inference method dynamic_decode_and_search just takes the embedding matrix and the start ids.