-
Notifications
You must be signed in to change notification settings - Fork 7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP * WIP: minor improvements * Add tests * Fix typo * Use download_and_extract on caltech, cifar and omniglot * Add a print message during extraction * Remove EMNIST from test
- Loading branch information
Showing
7 changed files
with
154 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import PIL | ||
import shutil | ||
import tempfile | ||
import unittest | ||
|
||
import torchvision | ||
|
||
|
||
class Tester(unittest.TestCase): | ||
|
||
def test_mnist(self): | ||
tmp_dir = tempfile.mkdtemp() | ||
dataset = torchvision.datasets.MNIST(tmp_dir, download=True) | ||
self.assertEqual(len(dataset), 60000) | ||
img, target = dataset[0] | ||
self.assertTrue(isinstance(img, PIL.Image.Image)) | ||
self.assertTrue(isinstance(target, int)) | ||
shutil.rmtree(tmp_dir) | ||
|
||
def test_kmnist(self): | ||
tmp_dir = tempfile.mkdtemp() | ||
dataset = torchvision.datasets.KMNIST(tmp_dir, download=True) | ||
img, target = dataset[0] | ||
self.assertTrue(isinstance(img, PIL.Image.Image)) | ||
self.assertTrue(isinstance(target, int)) | ||
shutil.rmtree(tmp_dir) | ||
|
||
def test_fashionmnist(self): | ||
tmp_dir = tempfile.mkdtemp() | ||
dataset = torchvision.datasets.FashionMNIST(tmp_dir, download=True) | ||
img, target = dataset[0] | ||
self.assertTrue(isinstance(img, PIL.Image.Image)) | ||
self.assertTrue(isinstance(target, int)) | ||
shutil.rmtree(tmp_dir) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
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