Bottom Page

Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Unable to understand reason for error IndexError: tuple index out of range
Hello this is my first post.I am getting the following error..

Quote:WARNING:tensorflow:From in main.: initialize_all_variables (from tensorflow.python.ops.variables) is deprecated and will be removed after 2017-03-02.
Instructions for updating:
Use tf.global_variables_initializer instead.
 No checkpoint found
amount of triplets is -2
Traceback (most recent call last):
  File "", line 282, in <module>
  File "", line 226, in main
    for batchx, batchy in create_batch(scene):
  File "", line 165, in create_batch
    data, y = create_triplets(scene)
  File "", line 153, in create_triplets
    input_duos = np.zeros((int(triplet_len/2)+1, images_shape[1], images_shape[2], images_shape[3] * 2))
IndexError: tuple index out of range

The code is a bit long and I am unable to provide links here(until I prove I am not a spammer!). Please let me know if you like to see the code and how I can share it with you.

This is an implementation of a research paper. I have copied this code from github and want to execute it so that I can gain deeper understanding of the concepts mentioned in the paper.
I really need your help.
Thanks in advance
Are you able to reproduce the problem with fewer lines? You should be able to hard-code whatever variables the problem line depends on with 5-10 lines, and still reproduce the problem you're seeing.
Feel like you're not getting the answers you want? Checkout the help/rules for things like what to include/not include in a post, how to use code tags, how to ask smart questions, and more.

Pro-tip - there's an inverse correlation between the number of lines of code posted and my enthusiasm for helping with a question :)
In line 153 this happens.
>>> t = (1, 2, 3)
>>> t[2]
>>> t[3]
Traceback (most recent call last):  File "<string>", line 301, in runcode  File "<interactive input>", line 1, in <module> IndexError: tuple index out of range
So you are trying to access a tuple value that has no index. 
So you have to check data(index) before it been used in this line.
Simple print() can help to understand eg print(images_shape[2]).
s/b t[0], t[1], and  t[2]

t[3] is beyond the range of the tuple thus the error.
(Dec-08-2016, 06:55 PM)rajat2504 Wrote: I have copied this code from github and want to execute it so that I can gain deeper understanding of the concepts mentioned in the paper.

If you did not code this yourself, you can file a bug report on github, so the author can review

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Getting Index Error - list index out of range RahulSingh 2 301 Feb-03-2020, 07:17 AM
Last Post: RahulSingh
  pandas.read_sas with chunksize: IndexError list index out of range axelle 0 129 Jan-28-2020, 09:30 AM
Last Post: axelle
  iterate over index and define each range as a day karlito 7 414 Nov-19-2019, 06:37 AM
Last Post: karlito
  IndexError: index out of bounds LeoGER 3 1,301 Sep-05-2019, 02:05 PM
Last Post: LeoGER
  Unable to identify Tuple index error appmkl 4 855 Jun-28-2019, 10:12 AM
Last Post: appmkl
  Can you help me with this error? IndexError: invalid index of a 0-dim tensor. DerBerliner 1 1,271 Feb-28-2019, 05:47 PM
Last Post: Larz60+
  Fatal Python error: initfsencoding: unable to load the file system codec gauravbhardwajee 11 13,699 Dec-03-2018, 08:29 PM
Last Post: gauravbhardwajee
  Using pandas, index error fyec 1 1,644 Aug-01-2018, 09:25 AM
Last Post: volcano63
  OverflowError: math range error Nick_helps 4 5,783 Jul-29-2018, 11:29 AM
Last Post: wavic
  Regarding index out of bounds error and implementing Loop error in backpropagation al geevaprasa 6 4,155 Apr-20-2018, 09:35 AM
Last Post: Larz60+

Forum Jump:

Users browsing this thread: 2 Guest(s)