Home > Net >  Difference between Model(inputs=[input],outputs=[output1,output2]) and Model(inputs=[input],outputs=
Difference between Model(inputs=[input],outputs=[output1,output2]) and Model(inputs=[input],outputs=

Time:10-20

Please check out the last line of the code

CodePudding user response:

In the code from your link, the model outputs is defined as [decoder_outputs2] dec_states2, where decoder_outputs2 seems to be an output from a Dense layer, and dec_states2 is a list of outputs from some other layers (dec_states = [decoder_state_h, decoder_state_c]). Therefore both [decoder_outputs2] and dec_states2 are python lists and can be concatenated using (see How do I concatenate two lists in Python?).

Doing outputs=[decoder_outputs2] dec_states2 means the model will have three outputs. It is equivalent to specifying outputs=[decoder_outputs2, decoder_state_h, decoder_state_c], the latter option definitely being more readable.

  • Related