I am working on CNN. What ever dataset i give as input to my CNN. I am getting below error. Can someone please advise further. I am really confused.
Traceback (most recent call last):
File "CNN_Fingerprint_5.py", line 118, in
verbose=1, validation_data=(X_test, Y_test))
File "/Users/prapo/anaconda/lib/python2.7/site-packages/keras/models.py", line 620, in fit
sample_weight=sample_weight)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/keras/engine/training.py", line 1104, in fit
callback_metrics=callback_metrics)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/keras/engine/training.py", line 822, in _fit_loop
outs = f(ins_batch)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/keras/backend/theano_backend.py", line 672, in __call__
return self.function(*inputs)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/theano/compile/function_module.py", line 871, in call
storage_map=getattr(self.fn, 'storage_map', None))
File "/Users/prapo/anaconda/lib/python2.7/site-packages/theano/gof/link.py", line 314, in raise_with_op
reraise(exc_type, exc_value, exc_trace)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/theano/compile/function_module.py", line 859, in call
outputs = self.fn()
File "/Users/prapo/anaconda/lib/python2.7/site-packages/theano/gof/op.py", line 912, in rval
r = p(n, [x[0] for x in i], o)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/theano/tensor/subtensor.py", line 2286, in perform
out[0][inputs[2:]] = inputs[1]
IndexError: index 1 is out of bounds for axis 1 with size 1
Apply node that caused the error: AdvancedIncSubtensor{inplace=False, set_instead_of_inc=True}(Alloc.0, TensorConstant{1}, ARange{dtype='int64'}.0, Elemwise{Cast{int32}}.0)
Toposort index: 70
Inputs types: [TensorType(float32, matrix), TensorType(int8, scalar), TensorType(int64, vector), TensorType(int32, vector)]
Inputs shapes: [(20, 1), (), (20,), (20,)]
Inputs strides: [(4, 4), (), (8,), (4,)]
Inputs values: ['not shown', array(1, dtype=int8), 'not shown', 'not shown']
Outputs clients: [[Reshape{2}(AdvancedIncSubtensor{inplace=False, set_instead_of_inc=True}.0, MakeVector{dtype='int64'}.0)]]
Backtrace when the node is created(use Theano flag traceback.limit=N to make it longer):
File "CNN_Fingerprint_5.py", line 113, in
model.compile(loss='sparse_categorical_crossentropy', optimizer='adadelta', metrics=["accuracy"])
File "/Users/prapo/anaconda/lib/python2.7/site-packages/keras/models.py", line 547, in compile
**kwargs)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/keras/engine/training.py", line 622, in compile
sample_weight, mask)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/keras/engine/training.py", line 324, in weighted
score_array = fn(y_true, y_pred)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/keras/objectives.py", line 44, in sparse_categorical_crossentropy
return K.sparse_categorical_crossentropy(y_pred, y_true)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/keras/backend/theano_backend.py", line 925, in sparse_categorical_crossentropy
target = T.extra_ops.to_one_hot(target, nb_class=output.shape[-1])
HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.
You have invalid interesting. All interesting star at index 0, not 1.
Normally label should follow that. Could this be the problem?
The real error message in just after the stack trace.
If the problem isn't with your dataset, email keras. The problem could be
there or in the script you implemented.
Le 19 sept. 2016 13:19, "prapo550" [email protected] a écrit :
I am working on CNN. What ever dataset i give as input to my CNN. I am
getting below error. Can someone please advise further. I am really
confused.
Traceback (most recent call last):
File "CNN_Fingerprint_5.py", line 118, in
verbose=1, validation_data=(X_test, Y_test))
File "/Users/prapo/anaconda/lib/python2.7/site-packages/keras/models.py",
line 620, in fit
sample_weight=sample_weight)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/keras/engine/training.py",
line 1104, in fit
callback_metrics=callback_metrics)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/keras/engine/training.py",
line 822, in_fit_loop outs = f(ins_batch) File
"/Users/prapo/anaconda/lib/python2.7/site-packages/keras/backend/theano_backend.py",
line 672, in __call__
return self.function(_inputs)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/
theano/compile/function_module.py", line 871, in *call_
storage_map=getattr(self.fn, 'storage_map', None))
File "/Users/prapo/anaconda/lib/python2.7/site-packages/theano/gof/link.py",
line 314, in raise_with_op
reraise(exc_type, exc_value, exc_trace)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/
theano/compile/function_module.py", line 859, in _call_
outputs = self.fn()
File "/Users/prapo/anaconda/lib/python2.7/site-packages/theano/gof/op.py",
line 912, in rval
r = p(n, [x[0] for x in i], o)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/theano/tensor/subtensor.py",
line 2286, in perform
out[0][inputs[2:]] = inputs[1]
IndexError: index 1 is out of bounds for axis 1 with size 1
Apply node that caused the error: AdvancedIncSubtensor{inplace=False,
set_instead_of_inc=True}(Alloc.0, TensorConstant{1},
ARange{dtype='int64'}.0, Elemwise{Cast{int32}}.0)
Toposort index: 70
Inputs types: [TensorType(float32, matrix), TensorType(int8, scalar),
TensorType(int64, vector), TensorType(int32, vector)]
Inputs shapes: [(20, 1), (), (20,), (20,)]
Inputs strides: [(4, 4), (), (8,), (4,)]
Inputs values: ['not shown', array(1, dtype=int8), 'not shown', 'not
shown']
Outputs clients: [[Reshape{2}(AdvancedIncSubtensor{inplace=False,
set_instead_of_inc=True}.0, MakeVector{dtype='int64'}.0)]]Backtrace when the node is created(use Theano flag traceback.limit=N to
make it longer):
File "CNN_Fingerprint_5.py", line 113, in
model.compile(loss='sparse_categorical_crossentropy',
optimizer='adadelta', metrics=["accuracy"])
File "/Users/prapo/anaconda/lib/python2.7/site-packages/keras/models.py",
line 547, in compile
**kwargs)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/keras/engine/training.py",
line 622, in compile
sample_weight, mask)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/keras/engine/training.py",
line 324, in weighted
score_array = fn(y_true, y_pred)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/keras/objectives.py",
line 44, in sparse_categorical_crossentropy
return K.sparse_categorical_crossentropy(y_pred, y_true)
File "/Users/prapo/anaconda/lib/python2.7/site-packages/keras/backend/theano_backend.py",
line 925, in sparse_categorical_crossentropy
target = T.extra_ops.to_one_hot(target, nb_class=output.shape[-1])HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and
storage map footprint of this apply node.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/Theano/Theano/issues/4989, or mute the thread
https://github.com/notifications/unsubscribe-auth/AALC-4wiSrn9N0x-CMOYHxR8EbAxzO_Qks5qrsQNgaJpZM4KAvMH
.
The actual error message is IndexError: index 1 is out of bounds for axis 1 with size 1.
As @nouiz tried to say despite his autocorrect, you are trying to index a tensor of size 1 with an index of 1, but indexing in Python starts at 0.
@lamblin
I also got exact same error message in a dataset that I am experimenting with. The dataset has large number of features but sparse (0s and 1s) and the labels are also binomial 0s and 1s. Now what can I do to get rid of the error. My trace shows IndexError: index 1 is out of bounds for axis 1 with size 1. Thank you in anticipation for your explanation because I am only a novice (a student) really in this field
indexing start at 0. so if you have a vector of size 1 like [10], to get
the first element you need to do your_vector[0], not your_vector[1].
This is probably the cause of this error.
On Thu, Apr 20, 2017 at 7:38 AM Shirish (Sam) Ranade <
[email protected]> wrote:
@lamblin https://github.com/lamblin
I also got exact same error message in a dataset that I am experimenting
with. The dataset has large number of features but sparse (0s and 1s) and
the labels are also binomial 0s and 1s. Now what can I do to get rid of the
error. My trace shows IndexError: index 1 is out of bounds for axis 1 with
size 1. Thank you in anticipation for your explanation because I am only a
novice (a student) really in this field—
You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub
https://github.com/Theano/Theano/issues/4989#issuecomment-295698532, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AALC-zv8se73NBXjuEMZuFcceIVC8RINks5rx0OzgaJpZM4KAvMH
.
Thanks Frédéric Bastien , Nouiz et al
I am not sure where do I have a vector of size 1. I'll investigate. Can I send you some Trace lines. If you have the time?
Frédéric Bastien , Nouiz et al,
I figured out the reason for my error. My inputs were all sparse binary (not sparse categorical). When I change the loss function to 'binary_crossentropy' instead of 'sparse_categorical_crossentropy' it is smooth run thereafter. It gives the same error if I switch back to 'sparse_categorical_crossentropy' ...so its repeatable.
thanks for the update.
I am working on UNET model.I am getting below error. Can someone please advise further.
RuntimeError: error getting worksize: CUDNN_STATUS_BAD_PARAM
Apply node that caused the error: GpuDnnConv{algo='small', inplace=True, num_groups=1}(GpuContiguous.0, GpuContiguous.0, GpuAllocEmpty{dtype='float32', context_name=None}.0, GpuDnnConvDesc{border_mode='half', subsample=(1, 1), dilation=(1, 1), conv_mode='conv', precision='float32', num_groups=1}.0, Constant{1.0}, Constant{0.0})
Toposort index: 402
Inputs types: [GpuArrayType
Inputs shapes: [(2, 1, 512, 512), (32, 1, 3, 3), (2, 32, 512, 512), 'No shapes', (), ()]
Inputs strides: [(1048576, 1048576, 2048, 4), (36, 36, 12, 4), (33554432, 1048576, 2048, 4), 'No strides', (), ()]
Inputs values: ['not shown', 'not shown', 'not shown',
Outputs clients: [[GpuElemwise{add,no_inplace}(GpuDnnConv{algo='small', inplace=True, num_groups=1}.0, InplaceGpuDimShuffle{x,0,x,x}.0)]]
Backtrace when the node is created(use Theano flag traceback.limit=N to make it longer):
File "/home/coe/anaconda2/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 705, in runfile
execfile(filename, namespace)
File "/home/coe/anaconda2/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 94, in execfile
builtins.execfile(filename, where)
File "/home/coe/UNET_CODE FROM GITHUB/Luna2016-Lung-Nodule-Detection-master/UNET/Code/LUNA_unet.py", line 208, in
model = train(False)
File "/home/coe/UNET_CODE FROM GITHUB/Luna2016-Lung-Nodule-Detection-master/UNET/Code/LUNA_unet.py", line 188, in train
model = get_unet_small(options)
File "/home/coe/UNET_CODE FROM GITHUB/Luna2016-Lung-Nodule-Detection-master/UNET/Code/LUNA_unet.py", line 72, in get_unet_small
conv1 = Convolution2D(32, options.filter_width, options.stride, activation='elu',border_mode='same')(inputs)
File "/home/coe/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 617, in __call__
output = self.call(inputs, *
File "/home/coe/anaconda2/lib/python2.7/site-packages/keras/layers/convolutional.py", line 168, in call
dilation_rate=self.dilation_rate)
File "/home/coe/anaconda2/lib/python2.7/site-packages/keras/backend/theano_backend.py", line 1916, in conv2d
filter_dilation=dilation_rate)
HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.
This is a completely different issue than the original ticket.
Moreover, requests for support should go to StackOverflow or the theano-users mailing list.
Most helpful comment
Frédéric Bastien , Nouiz et al,
I figured out the reason for my error. My inputs were all sparse binary (not sparse categorical). When I change the loss function to 'binary_crossentropy' instead of 'sparse_categorical_crossentropy' it is smooth run thereafter. It gives the same error if I switch back to 'sparse_categorical_crossentropy' ...so its repeatable.