Add type hints in mmcv/ops/active_rotated_filter.py (#2017)

* add typehints in ops-active-rotated-filter

* resolve typehints in ops-active-rotated-filter
pull/2021/head
ShawnHu 2022-05-28 19:57:27 +08:00 committed by GitHub
parent 19902d897a
commit 1577f40744
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
from typing import Tuple
import torch
from torch.autograd import Function
from torch.autograd.function import once_differentiable
@ -19,7 +21,8 @@ class ActiveRotatedFilterFunction(Function):
"""
@staticmethod
def forward(ctx, input, indices):
def forward(ctx, input: torch.Tensor,
indices: torch.Tensor) -> torch.Tensor:
"""
Args:
input (torch.Tensor): Input features with shape
@ -41,7 +44,7 @@ class ActiveRotatedFilterFunction(Function):
@staticmethod
@once_differentiable
def backward(ctx, grad_out):
def backward(ctx, grad_out: torch.Tensor) -> Tuple[torch.Tensor, None]:
"""
Args:
grad_output (torch.Tensor): The gradiant of output features