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
#1
Hello this is my first post.I am getting the following error..


Quote:WARNING:tensorflow:From create_animation.py:207 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
(0,)
(0,)
0
(0,)
amount of triplets is -2
Traceback (most recent call last):
  File "create_animation.py", line 282, in <module>
    main()
  File "create_animation.py", line 226, in main
    for batchx, batchy in create_batch(scene):
  File "create_animation.py", line 165, in create_batch
    data, y = create_triplets(scene)
  File "create_animation.py", 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
Quote
#2
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 :)
Quote
#3
In line 153 this happens.
>>> t = (1, 2, 3)
>>> t[2]
3
>>> t[3]
Error:
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]).
Quote
#4
s/b t[0], t[1], and  t[2]

t[3] is beyond the range of the tuple thus the error.
Quote
#5
(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
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  iterate over index and define each range as a day karlito 4 69 2 hours ago
Last Post: DeaD_EyE
  IndexError: index out of bounds LeoGER 3 357 Sep-05-2019, 02:05 PM
Last Post: LeoGER
  Unable to identify Tuple index error appmkl 4 473 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 948 Feb-28-2019, 05:47 PM
Last Post: Larz60+
  Fatal Python error: initfsencoding: unable to load the file system codec gauravbhardwajee 11 9,167 Dec-03-2018, 08:29 PM
Last Post: gauravbhardwajee
  Using pandas, index error fyec 1 1,238 Aug-01-2018, 09:25 AM
Last Post: volcano63
  OverflowError: math range error Nick_helps 4 4,396 Jul-29-2018, 11:29 AM
Last Post: wavic
  Regarding index out of bounds error and implementing Loop error in backpropagation al geevaprasa 6 3,482 Apr-20-2018, 09:35 AM
Last Post: Larz60+
  IndexEroor : index out of range adithyakrish 7 2,562 May-19-2017, 07:34 PM
Last Post: buran
  is a pandas dataframe timeseries time index in a specified range (but ignoring date)? m_lotinga 4 13,433 Dec-12-2016, 10:51 PM
Last Post: m_lotinga

Forum Jump:


Users browsing this thread: 1 Guest(s)