Solved by two_Two in post #2 
              
              
                The problem has been  solved, I change 
self.register_buffer('project'), torch.linspace(0, self.reg_max,self.reg_max + 1) 

to 
self.project = torch.arange(0, self.reg_max + 1 ).float() 

and everything works fine.