Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidArgumentError (see above for traceback): **indices[6,4]** = 23624 is not in [0, 23624) #39

Open
marc88 opened this issue Dec 7, 2018 · 1 comment

Comments

@marc88
Copy link

marc88 commented Dec 7, 2018

I get the following error after running an embedding layer as;

Embedding(23624, 50, input_length=5, trainable=False)

InvalidArgumentError (see above for traceback): indices[6,4] = 23624 is not in [0, 23624)
[[Node: embedding_1/embedding_lookup = Gather[Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@embedding_1/embeddings"], validate_indices=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](embedding_1/embeddings/read, embedding_1/Cast)]]

Each datapoint here is a number(index). Upon checking indices[6,4] I found the following

print(ar_train_data[6,4])
5088

ar_train_data is an array of shape (162896, 5) where each value is between [0, 23624).
The training stops towards the end of the first epoch with the error above.

Am amazed! 5088 is no where out of range for [0, 23624). Can anyone suggest what could be the issue here?
Please suggest if additional code snippets are required for clarity.
The model roughly goes below as:

inputs =  Input(shape=(None,),dtype='float32')
               <Embedding layer>
               <Convolution layer>
linear_output = Dense(10,input_shape=(72,),activation='relu')(linear_input)

model = Model(inputs=[inputs],outputs=[linear_output])
model.compile(loss='categorical_crossentropy', optimizer='nadam')

Keras version - 2.2.4
tensorflow version: 1.5.0

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants