Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/357.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 多通道卷积神经网络-负尺寸误差_Python_Keras_Conv Neural Network_Python 3.6 - Fatal编程技术网

Python 多通道卷积神经网络-负尺寸误差

Python 多通道卷积神经网络-负尺寸误差,python,keras,conv-neural-network,python-3.6,Python,Keras,Conv Neural Network,Python 3.6,我想设计,多频道CNN 我在第一步中收到一条错误消息。(图中,第一层至第二层) 我的密码就像风箱一样 _concat_embeded = keras.layers.concatenate([_embeding1, _embeding2], axis= -1) _biCH_embeded = keras.layers.Reshape((2, self.lexicalMaxLength, charWeights.shape[1]))(_concat_embeded) _1stConv = keras

我想设计,多频道CNN

我在第一步中收到一条错误消息。(图中,第一层至第二层)

我的密码就像风箱一样

_concat_embeded = keras.layers.concatenate([_embeding1, _embeding2], axis= -1)
_biCH_embeded = keras.layers.Reshape((2, self.lexicalMaxLength, charWeights.shape[1]))(_concat_embeded)
_1stConv = keras.layers.Conv2D(filters=512, kernel_size=(5, charWeights.shape[1]),
                               activation=tf.nn.relu)(_biCH_embeded)
_biCH_嵌入处的形状为[?2131131](我的嵌入具有131维=charWeights.Shape[1])

我想生成512个过滤器,它有(5131)个形状

然后,我得到了一条消息,“输入形状为[?,2,33131],[5131131512]的'conv2d_1/卷积'(op:'conv2d')从2减去5会导致负维度大小。”

问题在哪里

我发现了这个问题

我用“通道优先”规则(2133133)重塑了我的张量

但我的Keras配置是由“channel_last”设置的

我将重塑规则更改为“channel_last”(133133,2),现在开始训练


(如果您想更改Keras配置,请查看“~/.Keras/Keras.json”)

这是否回答了您的问题?