Reputation: 1936
I am trying to following this suggestion.
outputs = Conv2DTranspose(3, (1, 1), activation='sigmoid') (c9)
model = Model(inputs=[inputs], outputs=[outputs])
model = multi_gpu_model(model, gpus=8)
model.compile(optimizer='adam', loss = bce, metrics = [mean_iou])
model.add(Lambda(lambda x: K.batch_flatten(x)))
But at that last line of code, I receive the following error:
'Model' object has no attribute 'add'
I understand that since I didn't instantiate model as sequential()
as in linked post, the function add()
might not be available to me. However, I'm not sure how to work around this.
Upvotes: 0
Views: 92
Reputation: 1936
Going off @Today's answer in the OP's comments,
outputs = Lambda(lambda x: K.batch_flatten(x))(outputs)
Upvotes: 0
Reputation: 346
Corrected to reflect the working solution:
outputs = Conv2DTranspose(3, (1, 1), activation='sigmoid') (c9)
outputs = Lambda(lambda x: K.batch_flatten(x))(outputs)
model = Model(inputs=[inputs], outputs=[outputs])
model = multi_gpu_model(model, gpus=8)
model.compile(optimizer='adam', loss = bce, metrics = [mean_iou])
Upvotes: 1