0

fusion_model = tf.keras.layers.concatenate([m1.output, m2.output])

m1 and m2 are Model objects.

I'm concatenating the outputs of the two models and I'm getting the following error:

AttributeError: 'Sequential' object has no attribute '_nested_outputs'

This exact code used to work in TF 1.14. Any help? thanks

After experimenting with this example, it appears to crash on the statement m2.output (m1.output runs fine)

my M2 model is:

Layer (type)                 Output Shape              Param #   
=================================================================
rescaling_1 (Rescaling)      (None, 456, 456, 3)       0         
_________________________________________________________________
efficientnetb5 (Functional)  (None, 15, 15, 2048)      28513527  
_________________________________________________________________
global_average_pooling2d (Gl (None, 2048)              0         
_________________________________________________________________
dense_3 (Dense)              (None, 160)               327840    
_________________________________________________________________
dropout_19 (Dropout)         (None, 160)               0         
_________________________________________________________________
predictions (Dense)          (None, 19)                3059      
4
  • Do you mind sharing a code snippet so we can reproduce the error? Commented Sep 7, 2020 at 20:10
  • @stephen_mugisha Hi I will work on that :) Commented Sep 7, 2020 at 20:33
  • @stephen_mugisha Hi can't provide a full example but this is the best I can provide for now :) Commented Sep 7, 2020 at 21:03
  • check this previous discussion here , it may help Commented Sep 7, 2020 at 21:09

2 Answers 2

2

You need to build() the model with the appropriate input_shape parameter. This is what's causing this issue.

Sign up to request clarification or add additional context in comments.

Comments

2

I had this error and was able to solved it by adding a tf.keras.layers.InputLayer at the beginning of my model.

https://www.tensorflow.org/api_docs/python/tf/keras/layers/InputLayer

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.