How to refer to one output of multioutput model

29 Views Asked by At

I have a multioutput network of the following form (yes, the code is mostly from the medium article: https://medium.com/analytics-vidhya/implementing-a-gan-in-keras-d6c36bc6ab5f)

input = Input(shape=(100,50),dtype='float32')
drop_1 = Dropout(0.3,name='drop_1')(input)
dense_1 = Dense(20,activation='relu')(drop_1)
dense_2 = Dense(2)(dense_1)
flatten_1 = Flatten()(dense_2)
preds = Dense(7,activation='softmax')(flatten_1)

generator = Model(sequence_input, outputs=[preds,dense_2])
generator.compile(loss=['categorical_crossentropy',None],
          optimizer='adam',
          metrics=['acc']) 

Now I want to use the output in another network (I am trying to build a GAN) but therefor need to use the second output as follows:

Where I need the output:

gan_input = Input(shape=(100,50),dtype='float32')
fake = generator(gan_input)
gan_output = discriminator(fake[1]) 

How do I refer to it? fake[1] does not seem to work, it results in the following mistake:

TypeError: unsupported callable

Thank you very much!

0

There are 0 best solutions below