{"action":"created","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/2681","repository_url":"https://api.github.com/repos/fchollet/keras","labels_url":"https://api.github.com/repos/fchollet/keras/issues/2681/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/2681/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/2681/events","html_url":"https://github.com/fchollet/keras/issues/2681","id":153926285,"number":2681,"title":"OverflowError: Range exceeds valid bounds","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},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-05-10T05:25:57Z","updated_at":"2016-09-15T14:37:25Z","closed_at":null,"body":"My Convolutional neural net is giving me an error on the first DenseLayer, saying \"OverflowError: Range exceeds valid bounds\". My code looks correct given the other examples that I have consulted, but I'm not really sure.\r\n\r\n    IMAGE_HEIGHT = 6\r\n    IMAGE_WIDTH = 200\r\n    NUM_PEOPLE = 18\r\n\r\n    def gen_model():\r\n        \"\"\"\r\n        Generates the model to be used\r\n        :return: the model, untrained\r\n        \"\"\"\r\n        model = Sequential()\r\n   \r\n        model.add(Convolution2D(5, 5, 5, input_shape=(1, IMAGE_HEIGHT, IMAGE_WIDTH)))\r\n        model.add(AveragePooling2D(pool_size=(2, 2)))\r\n        model.add(Convolution2D(5, 5, 5))\r\n        model.add(AveragePooling2D(pool_size=(2, 2)))\r\n        model.add(Flatten())\r\n        model.add(Dense(output_dim=20))\r\n        model.add(Activation('relu'))\r\n        model.add(Dense(output_dim=18))\r\n        model.add(Activation('softmax'))\r\n        model.compile(optimizer=\"adagrad\", loss=\"categorical_crossentropy\", metrics=['accuracy'])\r\n        return model\r\n\r\nAnd here is the full traceback error:\r\n     `Traceback (most recent call last):`\r\n       `File \"/home/chris/Desktop/KerasCNN/model.py\", line 63, in <module>`\r\n         `main()`\r\n       `File \"/home/chris/Desktop/KerasCNN/model.py\", line 52, in main`\r\n         `model = gen_model()`\r\n       `File \"/home/chris/Desktop/KerasCNN/model.py\", line 31, in gen_model`\r\n         `model.add(Dense(output_dim=20))`\r\n       `File \"/usr/local/lib/python2.7/dist-packages/keras/models.py\", line 142, in add`\r\n         `output_tensor = layer(self.outputs[0])`\r\n       `File \"/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py\", line 458, in __call__`\r\n         `self.build(input_shapes[0])`\r\n       `File \"/usr/local/lib/python2.7/dist-packages/keras/layers/core.py\", line 596, in build`\r\n         `name='{}_W'.format(self.name))`\r\n       `File \"/usr/local/lib/python2.7/dist-packages/keras/initializations.py\", line 59, in glorot_uniform`\r\n         `return uniform(shape, s, name=name)`\r\n       `File \"/usr/local/lib/python2.7/dist-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`   \r\n       `(numpy/random/mtrand/mtrand.c:16656)`\r\n       `OverflowError: Range exceeds valid bounds`\r\n\r\n### **UPDATE**\r\nResolved issue by adding border_mode='same' to Convolutional layers. Now receiving error:\r\n\r\n`Exception: Error when checking model input: the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 1 arrays but instead got the following list of 540 arrays`\r\n\r\n### **UPDATE 2**\r\nResolved previous issue by doing train_concat = np.arry(train). Now receiving error:\r\n\r\n`ValueError: ('Bad input argument to theano function with name \"/usr/local/lib/python3.5/dist-packages/keras/backend/theano_backend.py:514\"  at index 0(0-based)', 'setting an array element with a sequence.')`"},"comment":{"url":"https://api.github.com/repos/fchollet/keras/issues/comments/247347006","html_url":"https://github.com/fchollet/keras/issues/2681#issuecomment-247347006","issue_url":"https://api.github.com/repos/fchollet/keras/issues/2681","id":247347006,"user":{"login":"jagiella","id":4679834,"avatar_url":"https://avatars.githubusercontent.com/u/4679834?v=3","gravatar_id":"","url":"https://api.github.com/users/jagiella","html_url":"https://github.com/jagiella","followers_url":"https://api.github.com/users/jagiella/followers","following_url":"https://api.github.com/users/jagiella/following{/other_user}","gists_url":"https://api.github.com/users/jagiella/gists{/gist_id}","starred_url":"https://api.github.com/users/jagiella/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jagiella/subscriptions","organizations_url":"https://api.github.com/users/jagiella/orgs","repos_url":"https://api.github.com/users/jagiella/repos","events_url":"https://api.github.com/users/jagiella/events{/privacy}","received_events_url":"https://api.github.com/users/jagiella/received_events","type":"User","site_admin":false},"created_at":"2016-09-15T14:37:24Z","updated_at":"2016-09-15T14:37:24Z","body":"Same problem here! I transfered my scripts to a different machine and the error popped up. On my old machine it is working flawlessly.\r\n\r\nMy code causing the problem:\r\n```\r\nmodel = Sequential()\r\n\t\t\r\nmodel.add(Convolution2D(self.nb_conv_filters, self.conv_kernel_size, self.conv_kernel_size, border_mode='valid', input_shape=(1, self.img_rows, self.img_cols)))\r\nmodel.add(Activation('relu'))\r\nmodel.add(MaxPooling2D(pool_size=(self.pool_kernel_size, self.pool_kernel_size)))\r\n\t\t\r\nmodel.add(Flatten())\r\n\t\t\r\nmodel.add(Dense(128))\r\nmodel.add(Activation('relu'))\r\nmodel.add(Dropout(0.5))\r\n\t\t\r\nmodel.add(Dense(self.nb_classes))\r\nmodel.add(Activation('softmax'))\r\n\t\t\r\nmodel.compile(loss='categorical_crossentropy',\r\n\t\t\t\t  optimizer='adadelta',\r\n\t\t\t\t  metrics=['accuracy'])\r\n```"}}
{"actor":{"display_login":"jagiella"}}