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
89edfaaa
You need to sign in or sign up before continuing.
Unverified
Commit
89edfaaa
authored
Mar 03, 2021
by
KAI ZHAO
Committed by
GitHub
Mar 03, 2021
Browse files
add __repr__ for transforms.RandomErasing (#3491)
parent
945f3a8b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
test/test_transforms.py
test/test_transforms.py
+3
-0
torchvision/transforms/transforms.py
torchvision/transforms/transforms.py
+8
-0
No files found.
test/test_transforms.py
View file @
89edfaaa
...
@@ -1991,6 +1991,9 @@ class Tester(unittest.TestCase):
...
@@ -1991,6 +1991,9 @@ class Tester(unittest.TestCase):
p_value
=
stats
.
binom_test
(
count_bigger_then_ones
,
trial
,
p
=
0.5
)
p_value
=
stats
.
binom_test
(
count_bigger_then_ones
,
trial
,
p
=
0.5
)
self
.
assertGreater
(
p_value
,
0.0001
)
self
.
assertGreater
(
p_value
,
0.0001
)
# Checking if RandomErasing can be printed as string
t
.
__repr__
()
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
torchvision/transforms/transforms.py
View file @
89edfaaa
...
@@ -1630,6 +1630,14 @@ class RandomErasing(torch.nn.Module):
...
@@ -1630,6 +1630,14 @@ class RandomErasing(torch.nn.Module):
return
F
.
erase
(
img
,
x
,
y
,
h
,
w
,
v
,
self
.
inplace
)
return
F
.
erase
(
img
,
x
,
y
,
h
,
w
,
v
,
self
.
inplace
)
return
img
return
img
def
__repr__
(
self
):
s
=
'(p={}, '
.
format
(
self
.
p
)
s
+=
'scale={}, '
.
format
(
self
.
scale
)
s
+=
'ratio={}, '
.
format
(
self
.
ratio
)
s
+=
'value={}, '
.
format
(
self
.
value
)
s
+=
'inplace={})'
.
format
(
self
.
inplace
)
return
self
.
__class__
.
__name__
+
s
class
GaussianBlur
(
torch
.
nn
.
Module
):
class
GaussianBlur
(
torch
.
nn
.
Module
):
"""Blurs image with randomly chosen Gaussian blur.
"""Blurs image with randomly chosen Gaussian blur.
...
...
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