You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use the layer method set_input_shape it sets the batch_input_shape, which in a convolutional layer case requires a 4dim tuple (batch_size,nb_channels,width,height).
When training a CNN with batch_input_shape rather than input_shape(3 dim), it throws an error at the end of the first epoch when training it.
This is the error: Epoch 1/1 49920/50000 [============================>.] - ETA: 0s - loss: 1.9490 - acc: 0.3118Traceback (most recent call last): File "/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pdb.py", line 1314, in main pdb._runscript(mainpyfile) File "/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pdb.py", line 1233, in _runscript self.run(statement) File "/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/bdb.py", line 400, in run exec cmd in globals, locals File "<string>", line 1, in <module> File "CNN_CIFAR_10_6.py", line 6, in <module> from keras.datasets import cifar10 File "CNN_CIFAR_10_6.py", line 49, in trainingMethod2 modelsToGatherFV[k].fit(X_train_tmp, Y_training, batch_size=batch_size, nb_epoch=nb_epochs,show_accuracy=True) File "/usr/local/lib/python2.7/site-packages/keras/models.py", line 646, in fit shuffle=shuffle, metrics=metrics) File "/usr/local/lib/python2.7/site-packages/keras/models.py", line 280, in _fit outs = f(ins_batch) File "/usr/local/lib/python2.7/site-packages/keras/backend/theano_backend.py", line 384, in __call__ return self.function(*inputs) File "/usr/local/lib/python2.7/site-packages/theano/compile/function_module.py", line 871, in __call__ storage_map=getattr(self.fn, 'storage_map', None)) File "/usr/local/lib/python2.7/site-packages/theano/gof/link.py", line 314, in raise_with_op reraise(exc_type, exc_value, exc_trace) File "/usr/local/lib/python2.7/site-packages/theano/compile/function_module.py", line 859, in __call__ outputs = self.fn() ValueError: GpuReshape: cannot reshape input of shape (80, 32, 30, 30) to shape (128, 28800). Apply node that caused the error: GpuReshape{2}(GpuElemwise{Composite{(i0 * (i1 + Abs(i1)))},no_inplace}.0, TensorConstant{[ 128 28800]}) Toposort index: 48 Inputs types: [CudaNdarrayType(float32, 4D), TensorType(int64, vector)] Inputs shapes: [(80, 32, 30, 30), (2,)] Inputs strides: [(28800, 900, 30, 1), (8,)] Inputs values: ['not shown', array([ 128, 28800])] Outputs clients: [[GpuDimShuffle{1,0}(GpuReshape{2}.0), GpuDot22(GpuReshape{2}.0, <CudaNdarrayType(float32, matrix)>)]]
If I set the input shape when initializing the layer it does not throw any error. So I would guess there is a conflict when using the full input shape (including batch size) and the fit method. Also, the batch size I am setting at the on the layer, is the same as in the fit method. Thank you.
The text was updated successfully, but these errors were encountered:
When I use the layer method set_input_shape it sets the batch_input_shape, which in a convolutional layer case requires a 4dim tuple (batch_size,nb_channels,width,height).
When training a CNN with batch_input_shape rather than input_shape(3 dim), it throws an error at the end of the first epoch when training it.
This is the error:
Epoch 1/1 49920/50000 [============================>.] - ETA: 0s - loss: 1.9490 - acc: 0.3118Traceback (most recent call last): File "/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pdb.py", line 1314, in main pdb._runscript(mainpyfile) File "/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pdb.py", line 1233, in _runscript self.run(statement) File "/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/bdb.py", line 400, in run exec cmd in globals, locals File "<string>", line 1, in <module> File "CNN_CIFAR_10_6.py", line 6, in <module> from keras.datasets import cifar10 File "CNN_CIFAR_10_6.py", line 49, in trainingMethod2 modelsToGatherFV[k].fit(X_train_tmp, Y_training, batch_size=batch_size, nb_epoch=nb_epochs,show_accuracy=True) File "/usr/local/lib/python2.7/site-packages/keras/models.py", line 646, in fit shuffle=shuffle, metrics=metrics) File "/usr/local/lib/python2.7/site-packages/keras/models.py", line 280, in _fit outs = f(ins_batch) File "/usr/local/lib/python2.7/site-packages/keras/backend/theano_backend.py", line 384, in __call__ return self.function(*inputs) File "/usr/local/lib/python2.7/site-packages/theano/compile/function_module.py", line 871, in __call__ storage_map=getattr(self.fn, 'storage_map', None)) File "/usr/local/lib/python2.7/site-packages/theano/gof/link.py", line 314, in raise_with_op reraise(exc_type, exc_value, exc_trace) File "/usr/local/lib/python2.7/site-packages/theano/compile/function_module.py", line 859, in __call__ outputs = self.fn() ValueError: GpuReshape: cannot reshape input of shape (80, 32, 30, 30) to shape (128, 28800). Apply node that caused the error: GpuReshape{2}(GpuElemwise{Composite{(i0 * (i1 + Abs(i1)))},no_inplace}.0, TensorConstant{[ 128 28800]}) Toposort index: 48 Inputs types: [CudaNdarrayType(float32, 4D), TensorType(int64, vector)] Inputs shapes: [(80, 32, 30, 30), (2,)] Inputs strides: [(28800, 900, 30, 1), (8,)] Inputs values: ['not shown', array([ 128, 28800])] Outputs clients: [[GpuDimShuffle{1,0}(GpuReshape{2}.0), GpuDot22(GpuReshape{2}.0, <CudaNdarrayType(float32, matrix)>)]]
If I set the input shape when initializing the layer it does not throw any error. So I would guess there is a conflict when using the full input shape (including batch size) and the fit method. Also, the batch size I am setting at the on the layer, is the same as in the fit method. Thank you.
The text was updated successfully, but these errors were encountered: