要使用多GPU,我升级了keras(1.2.0-> 2.2.4)版本。 我没有更改任何代码,但是有错误。 此错误的原因是什么?
我在下面附上了可复制的代码。 如您所见,A和B具有相同的形状,但是只有testB出现尺寸错误。
Collections.sort(entities, (o1, o2) -> o1.getLegNumber().compareTo(o2.getLegNumber()));
> pip3 install keras==1.2.0 --user
> python test.py
Using TensorFlow backend.
Done
这是可复制的代码。
> pip3 install git+git://github.com/fchollet/keras.git --upgrade --user
> python test.py
Using TensorFlow backend.
test.py:26: UserWarning: Update your `Conv1D` call to the Keras 2 API: `Conv1D(128, 3, use_bias=False)`
testA = keras.layers.Conv1D(128,3,bias=False)(A)
test.py:27: UserWarning: Update your `Conv1D` call to the Keras 2 API: `Conv1D(128, 3, use_bias=False)`
testB = keras.layers.Conv1D(128,3,bias=False)(B)
Traceback (most recent call last):
File "test.py", line 27, in <module>
testB = keras.layers.Conv1D(128,3,bias=False)(B)
File "/home/nam/.local/lib/python3.6/site-packages/keras/engine/base_layer.py", line 457, in __call__
output = self.call(inputs, **kwargs)
File "/home/nam/.local/lib/python3.6/site-packages/keras/layers/convolutional.py", line 163, in call
dilation_rate=self.dilation_rate[0])
File "/home/nam/.local/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 3881, in conv1d
data_format=tf_data_format)
File "/home/nam/.local/lib/python3.6/site-packages/tensorflow/python/ops/nn_ops.py", line 779, in convolution
data_format=data_format)
File "/home/nam/.local/lib/python3.6/site-packages/tensorflow/python/ops/nn_ops.py", line 839, in __init__
filter_shape[num_spatial_dims]))
ValueError: number of input channels does not match corresponding dimension of filter, 1 != 1603
我希望知道错误的原因。 我真的很喜欢尽可能使用这种形式, 但是如果不可能的话,您能告诉我如何解决该错误吗?
谢谢。