Skip to content
This repository was archived by the owner on May 28, 2022. It is now read-only.
This repository was archived by the owner on May 28, 2022. It is now read-only.

tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[4,0] = 10000 is not in [0, 10000) #1

Description

@shenGrant

Hi Gilbert,
Have u encountered this problem? i have not changed ur codes, and run it on local.
Thanks

Activity

  1. adam7902 commented on Dec 18, 2018

    @adam7902

    the same to you

    InvalidArgumentError (see above for traceback): indices[7,0] = 10000 is not in [0, 10000)

  2. TannerGilbert commented on Jan 4, 2019

    @TannerGilbert
    Owner

    Found the error. I used an wrong input_dim. It should be maximum integer index + 1 as explained in the Keras documentation and I just used the maximum integer index.

    Sorry for not answering earlier but I completely overlooked the issues. Furthermore it looks like this error only occurres when using a CPU and therefore it worked just fine for me. Now(after the bug fix) I tried it with both CPU and GPU and it works fine for me.

    Kind regards,
    Gilbert Tanner

  3. added a commit that references this issue on Jan 4, 2019
  4. pinned this issue on Jan 4, 2019
  5. bhansa commented on Apr 8, 2019

    @bhansa

    Hi @TannerGilbert,
    First of all, thanks for the notebook, it's very helpful. I got the same error while trying to run the code.
    Below are some details about my dataset and dimensions which I was passing. I tried to use the dot product example(method 1).

    train.head()
    
    BookID UserID USERRATINGS
    114530 644108 4
    114530 614998 4
    114530 618764 4
    114530 608366 4
    114530 655265 4
    n_users = len(dataset.UserID.unique())
    print(n_users) #12915
    
    n_books = len(dataset.BookID.unique())
    print(n_books) #4469
    
    InvalidArgumentError: indices[0,0] = 114530 is not in [0, 4470)
    	 [[{{node Book-Embedding_4/embedding_lookup}}]]

    Let me know if you have any idea about this issue.

    Thanks,
    Bharat

  6. TannerGilbert commented on Apr 8, 2019

    @TannerGilbert
    Owner

    Hello @bhansa,

    This error occurres when using the false input_dim for the embedding layers. The input_dim attribute for the embedding layer in Keras is defined as follows:

    • input_dim: int > 0. Size of the vocabulary, i.e. maximum integer index + 1.

    Maybe you need to add 1 as indicated above. Check out this stackoverflow post for more information.

    Hope this helped.

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