R-net
R-net copied to clipboard
InvalidArgumentError (see above for traceback): **indices[6,4]** = 23624 is not in [0, 23624)
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
Please refer to my answer here:
https://stackoverflow.com/questions/56890244/invalidargumenterror-see-above-for-traceback-indices47-6-24-is-not-in-0/57834436#57834436