expected scalar type float but found half

expected scalar type float but found half

This problem is obviously that the parameter types in the network do not agree;
modification:
add in front: I failed to test this

torch.set_default_tensor_type(torch.DoubleTensor)

torch.set_default_tensor_type(torch.FloatTensor)

  • 1

Alternatively, add before running the network:

net = net.double()

My workaround:

An error was reported during aimet training,

Directly find the place where the error is reported, add data.float() 

Guess you like

Origin blog.csdn.net/jacke121/article/details/129603188