@@ -10,26 +10,6 @@ def decorator(func):
10
10
return torch .library .impl_abstract (f"{ name } " )(func )
11
11
return decorator
12
12
13
- def nms (boxes : Tensor , scores : Tensor , iou_threshold : float ) -> Tensor :
14
- """
15
- See https://pytorch.org/vision/main/generated/torchvision.ops.nms.html
16
- """
17
- return torch .ops .torchao .nms .default (boxes , scores , iou_threshold )
18
-
19
-
20
- # Defines the meta kernel / fake kernel / abstract impl
21
- @register_custom_op ("torchao::nms" )
22
- def _ (dets , scores , iou_threshold ):
23
- torch ._check (dets .dim () == 2 , lambda : f"boxes should be a 2d tensor, got { dets .dim ()} D" )
24
- torch ._check (dets .size (1 ) == 4 , lambda : f"boxes should have 4 elements in dimension 1, got { dets .size (1 )} " )
25
- torch ._check (scores .dim () == 1 , lambda : f"scores should be a 1d tensor, got { scores .dim ()} " )
26
- torch ._check (
27
- dets .size (0 ) == scores .size (0 ),
28
- lambda : f"boxes and scores should have same number of elements in dimension 0, got { dets .size (0 )} and { scores .size (0 )} " ,
29
- )
30
- ctx = torch ._custom_ops .get_ctx ()
31
- num_to_keep = ctx .create_unbacked_symint ()
32
- return dets .new_empty (num_to_keep , dtype = torch .long )
33
13
34
14
35
15
def prepack_fp6_weight (fp6_weight : Tensor ) -> Tensor :
@@ -45,6 +25,7 @@ def prepack_fp6_weight(fp6_weight: Tensor) -> Tensor:
45
25
return torch .ops .torchao .prepack_fp6_weight .default (fp6_weight )
46
26
47
27
28
+ # Defines the meta kernel / fake kernel / abstract impl
48
29
@register_custom_op ("torchao::prepack_fp6_weight" )
49
30
def _ (fp6_weight ):
50
31
torch ._check (fp6_weight .dim () == 2 , lambda : f"weight should be a 2d tensor, got { fp6_weight .dim ()} D" )
0 commit comments