Solved by klory in post #2 
              
              
                Sol 1: define your own class for your inputs and inplement the to() function 
Sol2: 
self.data = {k: v.to(device) for k, v in self.data.items()}

Ref: