Solved by ptrblck in post #8 
              
              
                Thanks for the rest of the code. 
While running it I get a proper error message: 
RuntimeError: Tensor for argument #2 'mat1' is on CPU, but expected it to be on GPU (while checking arguments for addmm)

which points to a device mismatch in Generator. 
After checking the code it seems that z is crea…