Skip to content

Commit

Permalink
[fbsync] Fix typing issue to make DeformConv2d scriptable (#4079)
Browse files Browse the repository at this point in the history
Reviewed By: fmassa

Differential Revision: D29264317

fbshipit-source-id: 94339e7230eac691ffa5f33f8119ef47caee26b4
  • Loading branch information
NicolasHug authored and facebook-github-bot committed Jun 21, 2021
1 parent 6c39544 commit d28d8bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions test/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,10 @@ def test_autocast(self, batch_sz, dtype):
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):
Expand Down
2 changes: 1 addition & 1 deletion torchvision/ops/deform_conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def reset_parameters(self) -> None:
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
Expand Down

0 comments on commit d28d8bf

Please sign in to comment.