[英]while I was trying to train a DeepSpeech model on google colab, I'm getting an error saying that .whl file is not suported
[英]I'm trying to train the model using keras library but I'm getting value error
model = tf.keras.Sequential()
model.add(layers.Embedding(input_dim=2954, output_dim=64))
model.add(layers.LSTM(128))
model.add(layers.Dense(10))
model.compile(optimizer='rmsprop', loss='categorical_crossentropy', metrics=['accuracy'])
model.summary()
ValueError:一个形状为 (1, 2954) 的目标数组被传递给形状 (None, 10) 的输出,同时用作损失 categorical_crossentropy。 此损失期望目标与输出具有相同的形状。
检查您的目标/标签。 您的目标应该是单热编码的,因为您使用的是categorical_crossentropy
作为损失函数。 该错误抱怨您的目标数组的形状不是(batch_size, 10)
,而是(1, 2954)
PS最后一个Dense
层应该有一个 softmax 激活函数:
model.add(layers.Dense(10, activation='softmax'))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.