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
09f4b813
Unverified
Commit
09f4b813
authored
Jun 17, 2021
by
Nicolas Hug
Committed by
GitHub
Jun 17, 2021
Browse files
Fix typing issue to make DeformConv2d scriptable (#4079)
parent
562b8463
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
test/test_ops.py
test/test_ops.py
+4
-0
torchvision/ops/deform_conv.py
torchvision/ops/deform_conv.py
+1
-1
No files found.
test/test_ops.py
View file @
09f4b813
...
...
@@ -775,6 +775,10 @@ class TestDeformConv:
with
torch
.
cuda
.
amp
.
autocast
():
self
.
test_forward
(
torch
.
device
(
"cuda"
),
contiguous
=
False
,
batch_sz
=
batch_sz
,
dtype
=
dtype
)
def
test_forward_scriptability
(
self
):
# Non-regression test for https://github.com/pytorch/vision/issues/4078
torch
.
jit
.
script
(
ops
.
DeformConv2d
(
in_channels
=
8
,
out_channels
=
8
,
kernel_size
=
3
))
class
TestFrozenBNT
:
def
test_frozenbatchnorm2d_repr
(
self
):
...
...
torchvision/ops/deform_conv.py
View file @
09f4b813
...
...
@@ -149,7 +149,7 @@ class DeformConv2d(nn.Module):
bound
=
1
/
math
.
sqrt
(
fan_in
)
init
.
uniform_
(
self
.
bias
,
-
bound
,
bound
)
def
forward
(
self
,
input
:
Tensor
,
offset
:
Tensor
,
mask
:
Tensor
=
None
)
->
Tensor
:
def
forward
(
self
,
input
:
Tensor
,
offset
:
Tensor
,
mask
:
Optional
[
Tensor
]
=
None
)
->
Tensor
:
"""
Args:
input (Tensor[batch_size, in_channels, in_height, in_width]): input tensor
...
...
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