Skip to content

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

Description

@marc88

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions