[英]ValueError: Error when checking target: expected dense_2 to have 3 dimensions, but got array with shape (1012, 1)
[英]ValueError: Error when checking target: expected dense_2 to have 3 dimensions, but got array with shape (10000, 1)
我使用keras MLP网络进行三维字向量的二进制分类input_shape=(None,24,73)
。 我使用了两个密集层dense_1
和dense_2
。 在dense_2
我得到了一个我无法解决的错误。
这是我的模型摘要。
Layer (type) Output Shape Param #
=================================================================
dense_1 (Dense) (None, 8, 90) 6660
_________________________________________________________________
dense_2 (Dense) (None, 8, 1) 91
=================================================================
Total params: 6,751
Trainable params: 6,751
Non-trainable params: 0
ValueError:检查目标时出错:期望dense_2有3个维度,但得到的形状为数组(22,1)
由于你有一个binary_classification任务,你的最后一层应该看起来像这样
model.add(Dense(1, activation='sigmoid'))
现在你的模型是放置与你的目标形状不匹配的3D数组(2D)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.