{"action":"created","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/3225","repository_url":"https://api.github.com/repos/fchollet/keras","labels_url":"https://api.github.com/repos/fchollet/keras/issues/3225/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/3225/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/3225/events","html_url":"https://github.com/fchollet/keras/issues/3225","id":165597958,"number":3225,"title":"Is it possible to have a Merge function with two mode mul and sum working sequentially?","user":{"login":"mmoradik","id":15821704,"avatar_url":"https://avatars.githubusercontent.com/u/15821704?v=3","gravatar_id":"","url":"https://api.github.com/users/mmoradik","html_url":"https://github.com/mmoradik","followers_url":"https://api.github.com/users/mmoradik/followers","following_url":"https://api.github.com/users/mmoradik/following{/other_user}","gists_url":"https://api.github.com/users/mmoradik/gists{/gist_id}","starred_url":"https://api.github.com/users/mmoradik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmoradik/subscriptions","organizations_url":"https://api.github.com/users/mmoradik/orgs","repos_url":"https://api.github.com/users/mmoradik/repos","events_url":"https://api.github.com/users/mmoradik/events{/privacy}","received_events_url":"https://api.github.com/users/mmoradik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-07-14T16:02:18Z","updated_at":"2016-07-14T19:26:03Z","closed_at":null,"body":"I am new in keras. I have some problem working with merge.\r\n\r\nAssuming that I have 3 models. model1 has 4 outputs (px1,py1,px2,py2).  model 2 and models 3 each  has two outputs. (x1,y1) and (x2,y2) are outputs of each one of them respectively.\r\nMy question is how I can merge these models to have two outputs x,y:\r\nx=px1*x1+px2*x2\r\ny=py1*y1+py2*y2\r\n\r\nThrough the following code, the output of final model has 4 dimension representing (px1*x1, px2*x2, py1*y1, py2*y2). How can I reshape this output and sum to reach to x and y.\r\nor is there any way to merge only some outputs of a model with other model?\r\n\r\nmodel1=Sequential()\r\nmodel1.add(Dense(input_dim=10, output_dim=2*2))\r\nmodel1.add(Activation('softmax'))\r\n\r\nmodel2=Sequential()\r\nmodel2.add(Dense(input_dim=10, output_dim=2))\r\nmodel2.add(Activation('tanh'))\r\n\r\nmodel3=Sequential()\r\nmodel3.add(Dense(input_dim=10, output_dim=2))\r\nmodel3.add(Activation('tanh'))\r\n\r\nmerged_expert=Merge([model2,model3],mode='concat')\r\nmerged = Merge([model1, merged_expert], mode='mul')\r\n\r\nfinal_model = Sequential()\r\nfinal_model.add(merged)"},"comment":{"url":"https://api.github.com/repos/fchollet/keras/issues/comments/232766818","html_url":"https://github.com/fchollet/keras/issues/3225#issuecomment-232766818","issue_url":"https://api.github.com/repos/fchollet/keras/issues/3225","id":232766818,"user":{"login":"mmoradik","id":15821704,"avatar_url":"https://avatars.githubusercontent.com/u/15821704?v=3","gravatar_id":"","url":"https://api.github.com/users/mmoradik","html_url":"https://github.com/mmoradik","followers_url":"https://api.github.com/users/mmoradik/followers","following_url":"https://api.github.com/users/mmoradik/following{/other_user}","gists_url":"https://api.github.com/users/mmoradik/gists{/gist_id}","starred_url":"https://api.github.com/users/mmoradik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmoradik/subscriptions","organizations_url":"https://api.github.com/users/mmoradik/orgs","repos_url":"https://api.github.com/users/mmoradik/repos","events_url":"https://api.github.com/users/mmoradik/events{/privacy}","received_events_url":"https://api.github.com/users/mmoradik/received_events","type":"User","site_admin":false},"created_at":"2016-07-14T19:26:03Z","updated_at":"2016-07-14T19:26:03Z","body":"Thank you so much, now it works."}}
{"actor":{"display_login":"mmoradik"}}