The difference between feedforward networks and RNNs

A comparison between an RNN and a feedforward network is shown in the following diagram:

As you can observe in the preceding diagram, the RNN contains a looped connection in the hidden layer, which implies that we use the previous hidden state along with the input to predict the output.

Still confused? Let's look at the following unrolled version of an RNN. But wait; what is the unrolled version of an RNN?

It means that we roll out the network for a complete sequence. Let's suppose that we have an input sentence with words; then, we will have to layers, one for each word, as shown in the following figure:

As you can see in the preceding figure, at the time step , the output is predicted based on the current input and the previous hidden state . Similarly, at time step , is predicted using the current input and the previous hidden state . This is how an RNN works; it takes the current input and the previous hidden state to predict the output.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset