---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-32-12a4df166eda> in <module>
118
119 if __name__ == '__main__':
--> 120 main()
<ipython-input-32-12a4df166eda> in main()
64
65 model_name = "vgg16"
---> 66 net = vgg(model_name=model_name, num_classes=5, init_weights=True)
67 net.to(device)
68 loss_function = nn.CrossEntropyLoss()
~/Jupyter-notebook/pytorch学习/VGG-16/model.py in vgg(model_name, **kwargs)
76 print('Warning: model number {} not in cfgs dict'.format(model_name))
77 exit(-1)
---> 78 model = VGG(make_features(cfg), **kwargs) # 长度可变的字典变量
79 return model
80
~/Jupyter-notebook/pytorch学习/VGG-16/model.py in make_features(cfg)
55 layers += [nn.MaxPool2d(kernel_size=2, stride=2)]
56 else:
---> 57 conv2d = nn.Conv2d(in_channel, v, kernel_size=3, stride=1, padding=1)
58 layers += [conv2d, nn.ReLU(True)]
59 in_channel = v
~/.local/lib/python3.8/site-packages/torch/nn/modules/conv.py in __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation, groups, bias, padding_mode)
384 padding_ = _pair(padding)
385 dilation_ = _pair(dilation)
--> 386 super(Conv2d, self).__init__(
387 in_channels, out_channels, kernel_size_, stride_, padding_, dilation_,
388 False, _pair(0), groups, bias, padding_mode)
~/.local/lib/python3.8/site-packages/torch/nn/modules/conv.py in __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation, transposed, output_padding, groups, bias, padding_mode)
77 padding_mode: str) -> None:
78 super(_ConvNd, self).__init__()
---> 79 if in_channels % groups != 0:
80 raise ValueError('in_channels must be divisible by groups')
81 if out_channels % groups != 0:
TypeError: not all arguments converted during string formatting