pytorch-cifar100 icon indicating copy to clipboard operation
pytorch-cifar100 copied to clipboard

TypeError: forward() takes 2 positional arguments but 13 were given

Open Senwang98 opened this issue 4 years ago • 7 comments

when i run train.py, there is something wrong: TypeError: forward() takes 2 positional arguments but 13 were given 'writer.add_graph(net, Variable(input_tensor, requires_grad=True))'

So , you know how to deal?

Senwang98 avatar Jun 21 '20 08:06 Senwang98

I also want to ask whether you have known how to deal the question?

YTTHH avatar Jun 22 '20 13:06 YTTHH

I also want to ask whether you have known how to deal the question?

Sorry, this problem was ignored by me and the whole project can still run well. I just want to know how this problem happened.

Senwang98 avatar Jun 23 '20 02:06 Senwang98

Thanks for your answer.

YTTHH avatar Jun 28 '20 11:06 YTTHH

Met the same problem in python 3.6

momo1986 avatar Jul 01 '20 15:07 momo1986

same problem

GuaiYiHu avatar Jul 07 '20 08:07 GuaiYiHu

change https://github.com/weiaicunzai/pytorch-cifar100/blob/1fe2ec40dc05cd81fee6ab23de09b99fdb0d282f/train.py#L148 to input_tensor = torch.Tensor(1, 3, 32, 32).cuda()

GuaiYiHu avatar Jul 07 '20 08:07 GuaiYiHu

Do you guys still have the same problem??? I've already updated my code, using Pytorch build-in module torch.utils.tensorboard, and tested my code on Google Colab(python3.6, pytorch1.6), did not encounter this bug.

@GuaiYiHu @momo1986 @1187697147 @YTTHH

weiaicunzai avatar Aug 02 '20 09:08 weiaicunzai