# Types of RNNs

Although in the RNN structure shown previously, $$T_x = T_y$$ i.e. the lengths of input and output sequences were the same, this is not always the case.

## One-to-One RNN

Input and output sequences are of unit length.

![](https://3668624528-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5-0RGo4dZhdwCIHrC1%2F-M5-0TEuN77zAmTpQjIr%2F-M5-0WCeShOgRnpSidRz%2Fone-to-one%20rnn.PNG?generation=1586990829054797\&alt=media)

## One-to-Many RNN

Input sequence is of unit length but the output sequence has a length greater than 1.

Ex. Music Generation, input x could be the genre

![](https://3668624528-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5-0RGo4dZhdwCIHrC1%2F-M5-0TEuN77zAmTpQjIr%2F-M5-0WCgn80CXbDJolR1%2Fone-to-many%20rnn.PNG?generation=1586990835133461\&alt=media)

## Many-to-One RNN

Input sequence has a length greater than 1, but the output sequence is of unit length.

Ex. Text Sentiment Classification

![](https://3668624528-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5-0RGo4dZhdwCIHrC1%2F-M5-0TEuN77zAmTpQjIr%2F-M5-0WCiPnd0_U3fCXPF%2Fmany-to-one%20rnn.PNG?generation=1586990829126699\&alt=media)

## Many-to-Many RNN

### Input and output sequences are of equal length

Ex. Named Entity Recognition

![](https://3668624528-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5-0RGo4dZhdwCIHrC1%2F-M5-0TEuN77zAmTpQjIr%2F-M5-0WCkhwYXQ1Hca_fa%2Fmany-to-many-1%20rnn.PNG?generation=1586990828959948\&alt=media)

### Input and output sequences are of different lengths

Ex. Machine Translation i.e. language translation, say from English to French

![](https://3668624528-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5-0RGo4dZhdwCIHrC1%2F-M5-0TEuN77zAmTpQjIr%2F-M5-0WCmtRFqqFtoLvcU%2Fmany-to-many-2%20rnn.PNG?generation=1586990828961688\&alt=media)
