self.embed =顺序([Embedding(9488,output_dim = 512,input_length = 14),
Activation('relu'),
辍学(0.5)],名称='embed.0')
inputs_bedding = Input(shape =(10,))
xt = self.embed(inputs_bedding)
============================
keras_model.save('temp.h5')
使用h5py.File('temp.h5','a')为f:
model_weights = f ['model_weights']
params = util.dig_to_params(model_weights [layer])
def dig_to_params(keras_h5_layer):
而不是_contains_weights(keras_h5_layer):
keras_h5_layer = keras_h5_layer [list(keras_h5_layer.keys())[0]]
return keras_h5_layer <br>
错误:
keras_h5_layer = keras_h5_layer [list(keras_h5_layer.keys())[0]]
AttributeError:“数据集”对象没有属性“键”