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
323f5294
Commit
323f5294
authored
Apr 17, 2017
by
Soumith Chintala
Browse files
add test for Scale size list
parent
efd1bfe5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
test/test_transforms.py
test/test_transforms.py
+9
-3
No files found.
test/test_transforms.py
View file @
323f5294
...
...
@@ -59,15 +59,21 @@ class Tester(unittest.TestCase):
transforms
.
Scale
(
osize
),
transforms
.
ToTensor
(),
])(
img
)
# print img.size()
# print 'output size:', osize
# print result.size()
assert
osize
in
result
.
size
()
if
height
<
width
:
assert
result
.
size
(
1
)
<=
result
.
size
(
2
)
elif
width
<
height
:
assert
result
.
size
(
1
)
>=
result
.
size
(
2
)
result
=
transforms
.
Compose
([
transforms
.
ToPILImage
(),
transforms
.
Scale
([
osize
,
osize
]),
transforms
.
ToTensor
(),
])(
img
)
assert
osize
in
result
.
size
()
assert
result
.
size
(
1
)
==
osize
assert
result
.
size
(
2
)
==
osize
oheight
=
random
.
randint
(
5
,
12
)
*
2
owidth
=
random
.
randint
(
5
,
12
)
*
2
result
=
transforms
.
Compose
([
...
...
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