Moving tensor to cuda

This code was a part of a larger block, I created a Encoder module with a input layer of size n where as my vocab was n+2, fixing this solved the error.
I was confused as the IDE kept pointing at the cuda conversion lines as the bugs, I adapted the following:

  1. Shifted the model to cpu
  2. used try except and printed the exception string

Although, I could not understand how the layer mismatch gave rise to this error