Skip to content

Commit

Permalink
Making data set iterator compatible for Python 2 and 3.
Browse files Browse the repository at this point in the history
  • Loading branch information
rcamino committed Jan 28, 2019
1 parent c814aeb commit 4ff806a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion multi_categorical_gans/datasets/dataset.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import division

from future.utils import implements_iterator

import numpy as np


Expand All @@ -23,6 +25,7 @@ def batch_iterator(self, batch_size, shuffle=True):
return DatasetIterator(self.features, indices, batch_size)


@implements_iterator
class DatasetIterator(object):

def __init__(self, features, indices, batch_size):
Expand All @@ -36,7 +39,7 @@ def __init__(self, features, indices, batch_size):
def __iter__(self):
return self

def next(self):
def __next__(self):
if self.batch_index >= self.num_batches:
raise StopIteration
else:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
future==0.17.1
numpy==1.16.0
scikit-learn==0.20.2
scipy==1.2.0
Expand Down

0 comments on commit 4ff806a

Please sign in to comment.