PyTorch:expected scalar type Float but found Double

This problem is obviously that the parameter types in the network do not agree;
modification:
add in front:

torch.set_default_tensor_type(torch.DoubleTensor)

Or, add before running the network:

net = net.double()

Guess you like

Origin blog.csdn.net/sazass/article/details/109725458