Building the inference model

Let's try to recall the working mechanisms of the inference model and see how we can use components of the already-trained model to build it. The encoder part of the model should work by taking text sentences in the source language as an input, and provide the final hidden and cell state vectors, [hf; cf], as an output. We can't use the decoder network as is, since the target language input words can no longer be fed to the decoder. Instead, we collapse the decoder network to consist of a single step and provide the output of that step as an input to the next step. We start with the dummy word [START] as the first input word to the decoder, along with [hf; cf], serving as its initial hidden and cell states. The ...

Get Intelligent Projects Using Python now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.