我有这段代码:
<ion-select [(ngModel)]="select" [required]="true" [name]="value">
<ion-option *ngFor="let optionObj of responseData.parentData">
{{ optionObj?.ProblemId] }} - {{ optionObj?.ProblemDesc }}
</ion-option>
</ion-select>
但是我收到了这个错误:
lstm1=LSTM(40,
input_shape=(5,5),
dropout=0.2, recurrent_dropout=0.2,return_sequences=False)
lstm2=LSTM(40,
input_shape=(5, 5),
dropout=0.2, recurrent_dropout=0.2,return_sequences=False)
merged = merge([lstm1, lstm2], mode='concat',concat_axis=1)
我怎么能不使用Sequencial()(使用merge而不是Merge)?
目标是使用具有输出维度的maxpool图层的输出提供此合并图层:
merged = merge([lstm1, lstm2], mode='concat',concat_axis=1)
File "/home/rjpg/anaconda3/lib/python3.6/site-
packages/keras/legacy/layers.py", line 470, in merge
return merge_layer(inputs)
File "/home/rjpg/anaconda3/lib/python3.6/site-
packages/keras/engine/topology.py", line 549, in __call__
input_shapes.append(K.int_shape(x_elem))
File "/home/rjpg/anaconda3/lib/python3.6/site-
packages/keras/backend/tensorflow_backend.py", line 451, in int_shape
shape = x.get_shape()
AttributeError: 'LSTM' object has no attribute 'get_shape'
谢谢
答案 0 :(得分:0)
您的代码lstm1和lstm2是图层而不是输出
所以合并不起作用给予&#34;&#39; LSTM&#39;对象没有属性&#39; get_shape&#39;&#34;错误
像这样的第一个设计代码
inp = Input(...)
lstm1 = LSTM(...)(inp)
lstm2 = LSTM(...)(inp)
merged = merge([lstm1, lstm2], ...)