heuritech / convnets-keras

MIT License
594 stars 185 forks source link

Input Dimension Mismatch #32

Open cmgladding opened 7 years ago

cmgladding commented 7 years ago

Hello all,

I am getting a consistent error when attempting to train or predict with the verbatim AlexNet model. Using the example from the readme (preprocess dog.jpg, initialize model and SGD, compile with mse loss, predict), I receive the following error:

ValueError: GpuElemwise. Input dimension mis-match. Input 3 (indices start at 0) has shape[1] == 95, but the output's size on that axis is 96. Apply node that caused the error: GpuElemwise{Composite{(i0 + (i1 i2) + (i1 i3) + (i1 i4) + (i1 i5) + (i1 * i6))},no_inplace}(CudaNdarrayConstant{[[[[ 2.]]]]}, CudaNdarrayConstant{[[[[ 9.99999975e-05]]]]}, GpuDimShuffle{0,3,1,2}.0, GpuSubtensor{::, int64:int64:}.0, GpuSubtensor{::, int64:int64:}.0, GpuSubtensor{::, int64:int64:}.0, GpuSubtensor{::, int64:int64:}.0) Toposort index: 156 Inputs types: [CudaNdarrayType(float32, (True, True, True, True)), CudaNdarrayType(float32, (True, True, True, True)), CudaNdarrayType(float32, 4D), CudaNdarrayType(float32, 4D), CudaNdarrayType(float32, 4D), CudaNdarrayType(float32, 4D), CudaNdarrayType(float32, 4D)] Inputs shapes: [(1, 1, 1, 1), (1, 1, 1, 1), (1, 96, 27, 31), (1, 95, 27, 31), (1, 94, 27, 31), (1, 93, 27, 31), (1, 92, 27, 31)] Inputs strides: [(0, 0, 0, 0), (0, 0, 0, 0), (0, 1, 2976, 96), (0, 1, 2976, 96), (0, 1, 2976, 96), (0, 1, 2976, 96), (0, 1, 2976, 96)] Inputs values: [CudaNdarray([[[[ 2.]]]]), CudaNdarray([[[[ 9.99999975e-05]]]]), 'not shown', 'not shown', 'not shown', 'not shown', 'not shown'] Outputs clients: [[GpuElemwise{Composite{(i0 / (i1 * i2))}}[(0, 0)](GpuDnnPool{mode='max'}.0, GpuElemwise{Composite{(i0 + (i1 i2) + (i1 i3) + (i1 i4) + (i1 i5) + (i1 i6))},no_inplace}.0, CudaNdarrayConstant{[[[[ 0.75]]]]})]]

Does anyone else receive the same error? Based on the number 96 showing up, I wonder if it might have something to do with the output of conv1. Thanks in advance for any help.

cmgladding commented 7 years ago

After some troubleshooting, I isolated the error to "crosschannelnormalization()" in customlayers.py. Trying to figure out the exact issue now.