File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 1
1
import torch
2
2
from torch import Tensor
3
- from typing import List
3
+ from typing import List , Union
4
4
5
5
6
6
def _cat (tensors : List [Tensor ], dim : int = 0 ) -> Tensor :
@@ -24,7 +24,7 @@ def convert_boxes_to_roi_format(boxes: List[Tensor]) -> Tensor:
24
24
return rois
25
25
26
26
27
- def check_roi_boxes_shape (boxes : Tensor ):
27
+ def check_roi_boxes_shape (boxes : Union [ Tensor , List [ Tensor ]] ):
28
28
if isinstance (boxes , (list , tuple )):
29
29
for _tensor in boxes :
30
30
assert _tensor .size (1 ) == 4 , \
Original file line number Diff line number Diff line change
1
+ from typing import List , Union
2
+
1
3
import torch
2
4
from torch import nn , Tensor
3
-
4
5
from torch .nn .modules .utils import _pair
5
6
from torch .jit .annotations import BroadcastingList2
6
-
7
7
from torchvision .extension import _assert_has_ops
8
+
8
9
from ._utils import convert_boxes_to_roi_format , check_roi_boxes_shape
9
10
10
11
11
12
def roi_align (
12
13
input : Tensor ,
13
- boxes : Tensor ,
14
+ boxes : Union [ Tensor , List [ Tensor ]] ,
14
15
output_size : BroadcastingList2 [int ],
15
16
spatial_scale : float = 1.0 ,
16
17
sampling_ratio : int = - 1 ,
Original file line number Diff line number Diff line change
1
+ from typing import List , Union
2
+
1
3
import torch
2
4
from torch import nn , Tensor
3
-
4
5
from torch .nn .modules .utils import _pair
5
6
from torch .jit .annotations import BroadcastingList2
6
-
7
7
from torchvision .extension import _assert_has_ops
8
+
8
9
from ._utils import convert_boxes_to_roi_format , check_roi_boxes_shape
9
10
10
11
11
12
def roi_pool (
12
13
input : Tensor ,
13
- boxes : Tensor ,
14
+ boxes : Union [ Tensor , List [ Tensor ]] ,
14
15
output_size : BroadcastingList2 [int ],
15
16
spatial_scale : float = 1.0 ,
16
17
) -> Tensor :
You can’t perform that action at this time.
0 commit comments