Skip to content

Commit

Permalink
IBM Watson samples: from six.moves import xrange (kubeflow#1877)
Browse files Browse the repository at this point in the history
Discovered in kubeflow#1721

__xrange()__ was removed in Python 3 in favor of an improved version of __range()__.  This PR ensures equivalent functionality in both Python 2 and Python 3.

```
./samples/contrib/ibm-samples/watson/source/model-source-code/tf-model/input_data.py:100:40: F821 undefined name 'xrange'
            fake_image = [1.0 for _ in xrange(784)]
                                       ^
./samples/contrib/ibm-samples/watson/source/model-source-code/tf-model/input_data.py:102:41: F821 undefined name 'xrange'
            return [fake_image for _ in xrange(batch_size)], [
                                        ^
./samples/contrib/ibm-samples/watson/source/model-source-code/tf-model/input_data.py:103:37: F821 undefined name 'xrange'
                fake_label for _ in xrange(batch_size)]
                                    ^
```

@gaoning777 @Ark-kun Your reviews please.
  • Loading branch information
cclauss authored and k8s-ci-robot committed Aug 20, 2019
1 parent 79c7bda commit 6284dc1
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""Functions for downloading and reading MNIST data."""
import gzip
import os
from six.moves import xrange
from six.moves.urllib.request import urlretrieve
import numpy

Expand Down Expand Up @@ -144,4 +145,4 @@ class DataSets(object):
data_sets.train = DataSet(train_images, train_labels)
data_sets.validation = DataSet(validation_images, validation_labels)
data_sets.test = DataSet(test_images, test_labels)
return data_sets
return data_sets

0 comments on commit 6284dc1

Please sign in to comment.