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
bf38166d
Commit
bf38166d
authored
Sep 03, 2017
by
Sasank Chilamkurthy
Browse files
Modify assert for pad
parent
5a2bbc57
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
torchvision/transforms.py
torchvision/transforms.py
+6
-2
No files found.
torchvision/transforms.py
View file @
bf38166d
...
@@ -101,8 +101,12 @@ def scale(img, size, interpolation=Image.BILINEAR):
...
@@ -101,8 +101,12 @@ def scale(img, size, interpolation=Image.BILINEAR):
def
pad
(
img
,
padding
,
fill
=
0
):
def
pad
(
img
,
padding
,
fill
=
0
):
assert
isinstance
(
padding
,
numbers
.
Number
)
assert
isinstance
(
padding
,
(
numbers
.
Number
,
tuple
))
assert
isinstance
(
fill
,
numbers
.
Number
)
or
isinstance
(
fill
,
str
)
or
isinstance
(
fill
,
tuple
)
assert
isinstance
(
fill
,
(
numbers
.
Number
,
str
,
tuple
))
if
isinstance
(
padding
,
collections
.
Sequence
)
and
len
(
padding
)
not
in
[
2
,
4
]:
raise
ValueError
(
"Padding must be an int or a 2, or 4 element tuple, not a "
+
"{} element tuple"
.
format
(
len
(
padding
)))
return
ImageOps
.
expand
(
img
,
border
=
padding
,
fill
=
fill
)
return
ImageOps
.
expand
(
img
,
border
=
padding
,
fill
=
fill
)
...
...
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