Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
8759f303
Commit
8759f303
authored
Apr 10, 2019
by
Ashok M
Committed by
Soumith Chintala
Apr 10, 2019
Browse files
Added test for save image in utils (#847)
parent
6c77fdf6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
test/test_utils.py
test/test_utils.py
+8
-0
No files found.
test/test_utils.py
View file @
8759f303
import
os
import
torch
import
torch
import
torchvision.utils
as
utils
import
torchvision.utils
as
utils
import
unittest
import
unittest
...
@@ -35,6 +36,13 @@ class Tester(unittest.TestCase):
...
@@ -35,6 +36,13 @@ class Tester(unittest.TestCase):
assert
torch
.
equal
(
norm_max
,
rounded_grid_max
),
'Normalized max is not equal to 1'
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'
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__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment