[Solved] RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same

The error content is: the input is cuda type data, but the weight type used is not, and their types should be the same.

Solution :

Just change your network model to the cuda type (before using the model).

Such as model_class = yourModelName()

old version:   model_class(x)

new version: model_class.cuda()


Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *