Solved by miturian in post #2 
              
              
                I think I found the error myself: 
‘uOmega’ was not added correctly to the network, so it was not moved when I called net.to(cuda). 
The proper initialization is: 
        self.uOmega=nn.Parameter(torch.randn(self.attentionSize))