层“模型”的输入0与层不兼容:预期shape=(None,250,3),发现shape=(None,3)在训练的变压器模型中
tensorflow 199
原文标题 :Input of layer “model” is incompatible with the layer: expected shape=(None, 250, 3), found shape=(None, 3) in trained transformer model
我有一个用tensorflow2.7.0
和python3.7
训练的kerastransformer
模型,输入形状:(None, 250, 3)
和一个二维数组输入,形状:(250, 3)
(不是图像)
进行预测时:
prediction = model.predict(state)
我明白了ValueError: Input 0 of layer "model" is incompatible with the layer: expected shape=(None, 250, 3), found shape=(None, 3)
项目代码:https://github.com/MikeSifanele/TT
这是state
的样子:
state = np.array([[-0.07714844,-0.06640625,-0.140625],[-0.140625,-0.1650391,-0.2265625]...[0.6376953,0.6005859,0.6083984],[0.7714844,0.7441406,0.7578125]], np.float32)