It’s a little hard to tell from your snippet. I don’t think you should be calling model.forward: it should be model(x) (I’m not sure if those two are equivalent or if that has anything to do with this).
The cuda runtime error (59) is triggered most commonly when a memory location that is out of bounds is accessed (something like an array out of bounds error).