Your code runs fine on my machine. Which PyTorch version are you using?
Also some minor points:

usually it’s better to remove the .cuda() calls on your class members and just call model.cuda() after creation
instead of model.forward(x) you should just call model(x)