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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.