{"action":"created","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/2558","repository_url":"https://api.github.com/repos/fchollet/keras","labels_url":"https://api.github.com/repos/fchollet/keras/issues/2558/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/2558/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/2558/events","html_url":"https://github.com/fchollet/keras/issues/2558","id":151942099,"number":2558,"title":"Error creating shared node when using multiple Convolutional layers","user":{"login":"harshhemani","id":1217837,"avatar_url":"https://avatars.githubusercontent.com/u/1217837?v=3","gravatar_id":"","url":"https://api.github.com/users/harshhemani","html_url":"https://github.com/harshhemani","followers_url":"https://api.github.com/users/harshhemani/followers","following_url":"https://api.github.com/users/harshhemani/following{/other_user}","gists_url":"https://api.github.com/users/harshhemani/gists{/gist_id}","starred_url":"https://api.github.com/users/harshhemani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harshhemani/subscriptions","organizations_url":"https://api.github.com/users/harshhemani/orgs","repos_url":"https://api.github.com/users/harshhemani/repos","events_url":"https://api.github.com/users/harshhemani/events{/privacy}","received_events_url":"https://api.github.com/users/harshhemani/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2016-04-29T18:42:11Z","updated_at":"2016-05-11T04:54:28Z","closed_at":null,"body":"I am trying to run following script: \r\n```\r\nimport numpy as np\r\nfrom keras.models import Model\r\nfrom keras.layers import Input, Dense, merge\r\nfrom keras.layers import Convolution2D, MaxPooling2D, Flatten\r\n\r\ninput1 = Input((64, 64, 3))\r\ninput2 = Input((64, 64, 3))\r\n\r\nconv_1 = Convolution2D(32, 3, 3, activation='relu')\r\nconv_2 = Convolution2D(64, 3, 3, activation='relu')\r\nfl_3 = Flatten()\r\nfc_4 = Dense(64, activation='relu')\r\nfc_5 = Dense(32, activation='relu')\r\n\r\nrep1 = fc_5(fc_4(fl_3(conv_2(conv_1(input1)))))\r\nrep2 = fc_5(fc_4(fl_3(conv_2(conv_1(input2)))))\r\n#rep1 = fc_5(fc_4(fl_3(conv_1(input1))))\r\n#rep2 = fc_5(fc_4(fl_3(conv_1(input2))))\r\n\r\ncombined_vec = merge([rep1, rep2], mode='concat')\r\n\r\nfc_6 = Dense(64)(combined_vec)\r\nprediction = Dense(100, activation='softmax')(fc_6)\r\n\r\nmodel = Model([input1, input2], prediction)\r\nmodel.compile('sgd', 'categorical_crossentropy', metric=['accuracy'])\r\n```\r\n\r\nI get following error: \r\n```\r\nUsing Theano backend.\r\nTraceback (most recent call last):\r\n  File \"shared-example.py\", line 15, in <module>\r\n    rep1 = fc_5(fc_4(fl_3(conv_2(conv_1(input1)))))\r\n  File \"/usr/lib/python3.5/site-packages/keras/engine/topology.py\", line 458, in __call__\r\n    self.build(input_shapes[0])\r\n  File \"/usr/lib/python3.5/site-packages/keras/layers/core.py\", line 589, in build\r\n    name='{}_W'.format(self.name))\r\n  File \"/usr/lib/python3.5/site-packages/keras/initializations.py\", line 59, in glorot_uniform\r\n    return uniform(shape, s, name=name)\r\n  File \"/usr/lib/python3.5/site-packages/keras/initializations.py\", line 30, in uniform\r\n    return K.variable(np.random.uniform(low=-scale, high=scale, size=shape),\r\n  File \"mtrand.pyx\", line 1565, in mtrand.RandomState.uniform (numpy/random/mtrand/mtrand.c:17303)\r\nOverflowError: Range exceeds valid bounds\r\n```\r\n\r\nBut when I remove one of the convolutional layers (as done in commented code in above script), I do not get the error. I am guessing this error arises due to non integer value of scale passed to np.random.uniform. How can I solve this issue ?\r\n\r\nThanks.\r\n\r\nPS: I am using Keras using Theano backend on arch linux x64 with latest versions of all libraries."},"comment":{"url":"https://api.github.com/repos/fchollet/keras/issues/comments/218361555","html_url":"https://github.com/fchollet/keras/issues/2558#issuecomment-218361555","issue_url":"https://api.github.com/repos/fchollet/keras/issues/2558","id":218361555,"user":{"login":"ChrisHayduk","id":11514140,"avatar_url":"https://avatars.githubusercontent.com/u/11514140?v=3","gravatar_id":"","url":"https://api.github.com/users/ChrisHayduk","html_url":"https://github.com/ChrisHayduk","followers_url":"https://api.github.com/users/ChrisHayduk/followers","following_url":"https://api.github.com/users/ChrisHayduk/following{/other_user}","gists_url":"https://api.github.com/users/ChrisHayduk/gists{/gist_id}","starred_url":"https://api.github.com/users/ChrisHayduk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChrisHayduk/subscriptions","organizations_url":"https://api.github.com/users/ChrisHayduk/orgs","repos_url":"https://api.github.com/users/ChrisHayduk/repos","events_url":"https://api.github.com/users/ChrisHayduk/events{/privacy}","received_events_url":"https://api.github.com/users/ChrisHayduk/received_events","type":"User","site_admin":false},"created_at":"2016-05-11T04:54:28Z","updated_at":"2016-05-11T04:54:28Z","body":"@joelthchao Ok, thank you very much! I'll look into the data and see what could be causing these issue."}}