Thank you for your help. Based on previous study and your comments,  if I’m not mistaken, the error is due to tensor transferring from cpu to gpu ( model = model.to('cuda')). After this operation, self.weight_mat(x) is on gpu but the operation torch.DoubleTensor(self.weight_mat(x)) can only be done on cpu.
However, I don’t fully understand your solution. Since current error is from weight_prod = torch.DoubleTensor(self.weight_mat(x)), why you suggest operations on other variables out = out.double()?
How about just set
weight_prod = torch.nn.parameter(self.weight_mat(x))