We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6c77fdf commit 8759f30Copy full SHA for 8759f30
test/test_utils.py
@@ -1,3 +1,4 @@
1
+import os
2
import torch
3
import torchvision.utils as utils
4
import unittest
@@ -35,6 +36,13 @@ def test_normalize_in_make_grid(self):
35
36
assert torch.equal(norm_max, rounded_grid_max), 'Normalized max is not equal to 1'
37
assert torch.equal(norm_min, rounded_grid_min), 'Normalized min is not equal to 0'
38
39
+ def test_save_image(self):
40
+ t = torch.rand(2, 3, 64, 64)
41
+ file_name = 'test_image.png'
42
+ utils.save_image(t, file_name)
43
+ assert os.path.exists(file_name), 'The image is not present after save'
44
+ os.remove(file_name)
45
+
46
47
if __name__ == '__main__':
48
unittest.main()
0 commit comments