Skip to content

Commit

Permalink
Revert "Update usages of torch.library APIs (pytorch#8384)"
Browse files Browse the repository at this point in the history
This reverts commit a471305.
  • Loading branch information
huydhn committed Jun 8, 2024
1 parent a0be9d6 commit fbefdcc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion torchvision/_meta_registrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def meta_ps_roi_pool_backward(
return grad.new_empty((batch_size, channels, height, width))


@torch.library.register_fake("torchvision::nms")
@torch._custom_ops.impl_abstract("torchvision::nms")
def meta_nms(dets, scores, iou_threshold):
torch._check(dets.dim() == 2, lambda: f"boxes should be a 2d tensor, got {dets.dim()}D")
torch._check(dets.size(1) == 4, lambda: f"boxes should have 4 elements in dimension 1, got {dets.size(1)}")
Expand Down
1 change: 0 additions & 1 deletion torchvision/csrc/ops/nms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ at::Tensor nms(
}

TORCH_LIBRARY_FRAGMENT(torchvision, m) {
m.set_python_module("torchvision._meta_registrations");
m.def(TORCH_SELECTIVE_SCHEMA(
"torchvision::nms(Tensor dets, Tensor scores, float iou_threshold) -> Tensor"));
}
Expand Down

0 comments on commit fbefdcc

Please sign in to comment.