【问题标题】:TypeError: Merge can only be called on a list of tensors, not a single tensor in kerasTypeError: Merge 只能在张量列表上调用,而不是 keras 中的单个张量
【发布时间】:2021-04-26 12:04:08
【问题描述】:

我正在使用 1.15.5 版 tensorflow 和 1.2.2 版交叉。我可以实现其他模型,但是考虑到 DanQ 文章中的 load_weight,我无法对代码进行太多更改。

DanQ---> 1: https://github.com/uci-cbcl/DanQ

代码:

model1 = Sequential()
model1.add(LSTM(input_dim=320, output_dim=320, return_sequences=True))
model2 = Sequential()
model2.add(LSTM(input_dim=320, output_dim=320, return_sequences=True))
merged = Merge([model1, model2], mode='sum')

model = Sequential()
model.add(Convolution1D(320, border_mode='valid',filter_length=26, activation="relu", subsample_length=1,input_shape=(1000,4)))
model.add(MaxPooling1D(pool_length=13, stride=13))
model.add(Dropout(0.2))

model.add(merged)

model.add(Dropout(0.5))

model.add(Flatten())

model.add(Dense(input_dim=75*640, output_dim=925))
model.add(Activation('relu'))

model.add(Dense(input_dim=925, output_dim=919))
model.add(Activation('sigmoid'))

Error of this code:

【问题讨论】:

标签: python keras merge lstm bidirectional


【解决方案1】:

我找到了答案。 因为我必须使用低交叉版本。但是因为我无法访问较低版本的交叉,所以我使用最新的交叉更新了我的层。

【讨论】:

  • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
猜你喜欢
  • 2022-01-10
  • 1970-01-01
  • 2021-07-23
  • 1970-01-01
  • 2020-10-17
  • 1970-01-01
  • 2018-05-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多