I use Python version : 3.7 and Torch version : 1.10.0+cu111. The reason I used .to(self.device) in model init because it’s the only way I can use GPU in the model (because I can’t use model.cuda() ) and self._traverse_obj is a recursive method for my research.