forked from lisa-lab/pylearn2
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request lisa-lab#1251 from euphoris/python3
improve compatibility for python 3
- Loading branch information
Showing
59 changed files
with
336 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
Unit tests for ../transformer_dataset.py | ||
""" | ||
|
||
import os | ||
|
||
import pylearn2 | ||
from pylearn2.blocks import Block | ||
from pylearn2.datasets.csv_dataset import CSVDataset | ||
from pylearn2.datasets.transformer_dataset import TransformerDataset | ||
|
||
|
||
def test_transformer_iterator(): | ||
""" | ||
Tests whether TransformerIterator is iterable | ||
""" | ||
|
||
test_path = os.path.join(pylearn2.__path__[0], | ||
'datasets', 'tests', 'test.csv') | ||
raw = CSVDataset(path=test_path, expect_headers=False) | ||
block = Block() | ||
dataset = TransformerDataset(raw, block) | ||
iterator = dataset.iterator('shuffled_sequential', 3) | ||
try: | ||
iter(iterator) | ||
except TypeError: | ||
assert False, "TransformerIterator isn't iterable" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
""" | ||
Convert a .pkl from Python 2 to Python 3 | ||
""" | ||
|
||
import pickle | ||
import sys | ||
|
||
|
||
if __name__ == "__main__": | ||
source_pkl = sys.argv[1] | ||
try: | ||
target_pkl = sys.argv[2] | ||
except IndexError: | ||
target_pkl = source_pkl | ||
with open(source_pkl, 'rb') as f: | ||
obj = pickle.load(f, encoding='latin-1') | ||
with open(target_pkl, 'wb') as f: | ||
pickle.dump(obj, f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.