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
2cc83594
Unverified
Commit
2cc83594
authored
Jun 01, 2021
by
Vasilis Vryniotis
Committed by
GitHub
Jun 01, 2021
Browse files
Turn on fast gradcheck for DeformConv to speed-up tests (#3933)
parent
9b29f3f2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
test/test_ops.py
test/test_ops.py
+4
-4
No files found.
test/test_ops.py
View file @
2cc83594
...
...
@@ -725,13 +725,13 @@ class DeformConvTester(OpTester, unittest.TestCase):
return
ops
.
deform_conv2d
(
x_
,
offset_
,
weight_
,
bias_
,
stride
=
stride
,
padding
=
padding
,
dilation
=
dilation
,
mask
=
mask_
)
gradcheck
(
func
,
(
x
,
offset
,
mask
,
weight
,
bias
),
nondet_tol
=
1e-5
)
gradcheck
(
func
,
(
x
,
offset
,
mask
,
weight
,
bias
),
nondet_tol
=
1e-5
,
fast_mode
=
True
)
def
func_no_mask
(
x_
,
offset_
,
weight_
,
bias_
):
return
ops
.
deform_conv2d
(
x_
,
offset_
,
weight_
,
bias_
,
stride
=
stride
,
padding
=
padding
,
dilation
=
dilation
,
mask
=
None
)
gradcheck
(
func_no_mask
,
(
x
,
offset
,
weight
,
bias
),
nondet_tol
=
1e-5
)
gradcheck
(
func_no_mask
,
(
x
,
offset
,
weight
,
bias
),
nondet_tol
=
1e-5
,
fast_mode
=
True
)
@
torch
.
jit
.
script
def
script_func
(
x_
,
offset_
,
mask_
,
weight_
,
bias_
,
stride_
,
pad_
,
dilation_
):
...
...
@@ -740,7 +740,7 @@ class DeformConvTester(OpTester, unittest.TestCase):
padding
=
pad_
,
dilation
=
dilation_
,
mask
=
mask_
)
gradcheck
(
lambda
z
,
off
,
msk
,
wei
,
bi
:
script_func
(
z
,
off
,
msk
,
wei
,
bi
,
stride
,
padding
,
dilation
),
(
x
,
offset
,
mask
,
weight
,
bias
),
nondet_tol
=
1e-5
)
(
x
,
offset
,
mask
,
weight
,
bias
),
nondet_tol
=
1e-5
,
fast_mode
=
True
)
@
torch
.
jit
.
script
def
script_func_no_mask
(
x_
,
offset_
,
weight_
,
bias_
,
stride_
,
pad_
,
dilation_
):
...
...
@@ -749,7 +749,7 @@ class DeformConvTester(OpTester, unittest.TestCase):
padding
=
pad_
,
dilation
=
dilation_
,
mask
=
None
)
gradcheck
(
lambda
z
,
off
,
wei
,
bi
:
script_func_no_mask
(
z
,
off
,
wei
,
bi
,
stride
,
padding
,
dilation
),
(
x
,
offset
,
weight
,
bias
),
nondet_tol
=
1e-5
)
(
x
,
offset
,
weight
,
bias
),
nondet_tol
=
1e-5
,
fast_mode
=
True
)
@
unittest
.
skipIf
(
not
torch
.
cuda
.
is_available
(),
"CUDA unavailable"
)
def
test_compare_cpu_cuda_grads
(
self
):
...
...
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