Tensorflow 调用层时使用的输入为';t是符号张量

Tensorflow 调用层时使用的输入为';t是符号张量,tensorflow,keras,Tensorflow,Keras,我遵循我在上找到的代码 复制粘贴代码时,出现错误: ValueError: Layer batch_normalization_1 was called with an input that isn't a symbolic tensor. 与博客作者不同的是,我出现错误的原因是什么?您似乎没有向密集层提供输入 feature_input = Input(shape=(sentences_features.shape[1],)) dense = Dense(128, activation=a

我遵循我在上找到的代码

复制粘贴代码时,出现错误:

ValueError: Layer batch_normalization_1 was called with an input that isn't a symbolic tensor.


与博客作者不同的是,我出现错误的原因是什么?

您似乎没有向密集层提供输入

feature_input = Input(shape=(sentences_features.shape[1],))
dense = Dense(128, activation=activations.relu)
merged = BatchNormalization()(dense)
尝试:


请在你的问题中填写完整的回溯和代码谢谢。但是现在得到不同的错误-NameError:name'Model'没有定义。你们进口了这个型号吗?我看不出代码中,[来自keras.models导入模型]仍然存在错误:ValueError:模型的输入张量必须来自keras.layers.Inputmodel=Model(inputs=[word\u index],outputs=preds),在这一行中word\u index是外部变量。你不能这样使用它。它必须通过输入层传递给模型。
dense = Dense(128, activation=activations.relu)(feature_input)