我有一个功能模型,该模型在具有<div class="container">
<p class="section-description" id="txt">Today I went to the zoo. I saw a(n) <input placeholder="noun" id="noun1"> <input placeholder="adjective" id="adjective1"> jumping up and down in its tree. He <input placeholder="verb, past tense" id="verb1"> <input placeholder="adverb" id="adverb1"> through the large tunnel that led to its <input placeholder="adjective" id="adjective2"> <input placeholder="noun" id="noun2">. I got some peanuts and passed them through the cage to a gigantic gray <input placeholder="noun" id="noun3"> towering above my head. Feeding that animal made me. </p>
</div>
层的keras循环中创建多个门:
int 16h
当我尝试加载模型时,它抱怨:
Lambda
在添加predictions = []
for ii, kk in enumerate(label_cols):
slicer = Lambda(lambda x: x[:,:,:,ii:ii+1],
output_shape=gates_shape[:-2]+(1,),
name='slice_'+kk)
gate_ = slicer(gates)
...
prediction = Dense(n_classes[kk], activation=final_activation, name=kk)(x)
predictions.append(prediction)
之前,一切正常。
正确的方法是什么?
答案 0 :(得分:1)
ii
变量不在lambda范围内,因此您必须将其通过arguments
传递。
尝试:
x = Lambda(lambda x,ii: x[:,:,:,ii:ii+1], arguments={'ii':ii})