Skip to content

Commit

Permalink
Fix initialization of index_array
Browse files Browse the repository at this point in the history
index_array should be initialized when self.batch_index is zero.
  • Loading branch information
henry0312 committed May 7, 2016
1 parent bb626c1 commit 2601dcd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion keras/preprocessing/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,12 @@ def reset(self):
self.batch_index = 0

def _flow_index(self, N, batch_size=32, shuffle=False, seed=None):
# ensure self.batch_index is 0
self.reset()

while 1:
index_array = np.arange(N)
if self.batch_index == 0:
index_array = np.arange(N)
if shuffle:
if seed is not None:
np.random.seed(seed + self.total_batches_seen)
Expand Down

0 comments on commit 2601dcd

Please sign in to comment.