2022-01-12 22:20:24.272950: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2 To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. Traceback (most recent call last): File "E:/Code/PyCharm/深度学习/图像分类/NIN/train.py", line 27, in <module> history = model.NIN(10) File "E:\Code\PyCharm\深度学习\图像分类\NIN\model.py", line 26, in __init__ kernel_size=1) File "D:\Anaconda\lib\site-packages\tensorflow\python\training\tracking\base.py", line 530, in _method_wrapper result = method(self, *args, **kwargs) TypeError: __init__() takes from 1 to 3 positional arguments but 6 were given
问题原因:
我在使用Sequential
模块搭建网络时,中间掺杂不同的层,但是我们有用列表进行封装,所以导致参数不对应
解决方案:
使用列表进行封装使之成为一个参数
self.mlpconv1 = Sequential([ Conv2D(filters=6, kernel_size=1), ReLU(), Conv2D(filters=6, kernel_size=1), ReLU(), Conv2D(filters=6, kernel_size=1)] )