Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions test/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import torch
import torchvision.utils as utils
import unittest
Expand Down Expand Up @@ -35,6 +36,13 @@ def test_normalize_in_make_grid(self):
assert torch.equal(norm_max, rounded_grid_max), 'Normalized max is not equal to 1'
assert torch.equal(norm_min, rounded_grid_min), 'Normalized min is not equal to 0'

def test_save_image(self):
t = torch.rand(2, 3, 64, 64)
file_name = 'test_image.png'
utils.save_image(t, file_name)
assert os.path.exists(file_name), 'The image is not present after save'
os.remove(file_name)


if __name__ == '__main__':
unittest.main()