Skip to content

Commit

Permalink
fix get_example index
Browse files Browse the repository at this point in the history
  • Loading branch information
tanaken0515 committed Nov 10, 2019
1 parent 3cd9b72 commit 7234ea1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/chainer/datasets/sub_dataset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ def size
@size
end

def get_example(index)
if index >= 0
if index >= @size
def get_example(i)
if i >= 0
if i >= @size
raise IndexError, 'dataset index out of range'
end
index = @start + 1
index = @start + i
else
if index < -1 * @size
if i < -1 * @size
raise IndexError, 'dataset index out of range'
end
index = @finish + 1
index = @finish + i
end

index = @order[index] if @order
Expand Down

0 comments on commit 7234ea1

Please sign in to comment.