我不明白出了什么问题。我需要有两组输入,所以我将它们分开以给每个输入一个名称(服务目的),然后将它们连接起来以将它们链接到下一层。
layer_input1 = tf.keras.Input(shape=(None, 1), name='layer1')
layer_input2 = tf.keras.Input(shape=(None, 1), name='layer2')
layer_input = tf.keras.layers.concatenate([layer_input1, layer_input2], name='inputs')
fc_1 = tf.keras.layers.Dense(2,
activation='relu')(layer_input)
fc_1 = tf.keras.layers.Dropout(0.5)(fc_1)
fc_2 = tf.keras.layers.Dense(10,
activation='relu')(fc_1)
output_layer = tf.keras.layers.Dense(1,
activation='relu', name='predictions')(fc_2)
model = tf.keras.Model(inputs=layer_input, outputs=output_layer)
AttributeError Traceback (most recent call last)
<ipython-input-430-b567199137e0> in <module>()
10 output_layer = tf.keras.layers.Dense(1,
11 activation='relu', name='predictions')(fc_2)
---> 12 model = tf.keras.Model(inputs=layer_input, outputs=output_layer)
AttributeError: 'Model' object has no attribute '_name'
Qyouu
相关分类