Why is summary of model need cuda?

I have a model thats on cpu (not on cuda), and i tried to use “from torchsummary import summary” and

summary(model, (1, 784))

but i got this error:

Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same

Why the input type need to be “cuda”? Why is summary(…) requiring this? Am I doing something wrong? I am aware that i can make this work by doing a model.cuda(), but I want it to stay on CPU.

I think that might be because the summary function of torchsummary has a device parameter. Try

summary(model, (1, 784), device="cpu")

Also, for questions about external packages, it would be better to ask on the external package’s issue tracker or discussion platform.

4 Likes

Ah… Thanks. I didn’t notice it, and the default is actually cuda.