diff --git a/test/tracing/frcnn/test_frcnn_tracing.cpp b/test/tracing/frcnn/test_frcnn_tracing.cpp index 90476b24f4b..7b10aee3c89 100644 --- a/test/tracing/frcnn/test_frcnn_tracing.cpp +++ b/test/tracing/frcnn/test_frcnn_tracing.cpp @@ -7,7 +7,7 @@ #ifdef _WIN32 // Windows only // This is necessary until operators are automatically registered on include -static auto _nms = &nms_cpu; +static auto _nms = &vision::ops::nms_cpu; #endif int main() { diff --git a/torchvision/csrc/cpu/deform_conv2d_kernel.cpp b/torchvision/csrc/cpu/deform_conv2d_kernel.cpp index 5cac99db04a..4ae2d0a02db 100644 --- a/torchvision/csrc/cpu/deform_conv2d_kernel.cpp +++ b/torchvision/csrc/cpu/deform_conv2d_kernel.cpp @@ -68,6 +68,9 @@ #include "deform_conv2d_kernel.h" +namespace vision { +namespace ops { + namespace { const int kMaxParallelImgs = 32; @@ -1137,3 +1140,6 @@ deform_conv2d_backward_cpu( return std::make_tuple( grad_input, grad_weight, grad_offset, grad_mask, grad_bias); } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cpu/deform_conv2d_kernel.h b/torchvision/csrc/cpu/deform_conv2d_kernel.h index 2eb5ab37c6e..2a49bad8304 100644 --- a/torchvision/csrc/cpu/deform_conv2d_kernel.h +++ b/torchvision/csrc/cpu/deform_conv2d_kernel.h @@ -3,6 +3,9 @@ #include #include "../macros.h" +namespace vision { +namespace ops { + VISION_API at::Tensor deform_conv2d_forward_cpu( const at::Tensor& input, const at::Tensor& weight, @@ -37,3 +40,6 @@ VISION_API std:: int64_t n_weight_grps, int64_t n_offset_grps, bool use_mask); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cpu/nms_kernel.cpp b/torchvision/csrc/cpu/nms_kernel.cpp index 52953a9e822..a77a6906870 100644 --- a/torchvision/csrc/cpu/nms_kernel.cpp +++ b/torchvision/csrc/cpu/nms_kernel.cpp @@ -1,5 +1,8 @@ #include "nms_kernel.h" +namespace vision { +namespace ops { + namespace { template @@ -103,3 +106,6 @@ at::Tensor nms_cpu( }); return result; } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cpu/nms_kernel.h b/torchvision/csrc/cpu/nms_kernel.h index 7b6ef442626..1fdcaf3d3f9 100644 --- a/torchvision/csrc/cpu/nms_kernel.h +++ b/torchvision/csrc/cpu/nms_kernel.h @@ -3,7 +3,13 @@ #include #include "../macros.h" +namespace vision { +namespace ops { + VISION_API at::Tensor nms_cpu( const at::Tensor& dets, const at::Tensor& scores, double iou_threshold); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cpu/ps_roi_align_kernel.cpp b/torchvision/csrc/cpu/ps_roi_align_kernel.cpp index 3d6c95f02ea..5abe4a41477 100644 --- a/torchvision/csrc/cpu/ps_roi_align_kernel.cpp +++ b/torchvision/csrc/cpu/ps_roi_align_kernel.cpp @@ -1,5 +1,8 @@ #include "ps_roi_align_kernel.h" +namespace vision { +namespace ops { + namespace { template @@ -416,3 +419,6 @@ at::Tensor ps_roi_align_backward_cpu( }); return grad_input; } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cpu/ps_roi_align_kernel.h b/torchvision/csrc/cpu/ps_roi_align_kernel.h index 86a3f9a8876..a4bea77853b 100644 --- a/torchvision/csrc/cpu/ps_roi_align_kernel.h +++ b/torchvision/csrc/cpu/ps_roi_align_kernel.h @@ -3,6 +3,9 @@ #include #include "../macros.h" +namespace vision { +namespace ops { + VISION_API std::tuple ps_roi_align_forward_cpu( const at::Tensor& input, const at::Tensor& rois, @@ -23,3 +26,6 @@ VISION_API at::Tensor ps_roi_align_backward_cpu( int64_t channels, int64_t height, int64_t width); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cpu/ps_roi_pool_kernel.cpp b/torchvision/csrc/cpu/ps_roi_pool_kernel.cpp index cdee9b9f55c..425b4c68f1a 100644 --- a/torchvision/csrc/cpu/ps_roi_pool_kernel.cpp +++ b/torchvision/csrc/cpu/ps_roi_pool_kernel.cpp @@ -1,5 +1,8 @@ #include "ps_roi_pool_kernel.h" +namespace vision { +namespace ops { + namespace { template @@ -255,3 +258,6 @@ at::Tensor ps_roi_pool_backward_cpu( }); return grad_input; } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cpu/ps_roi_pool_kernel.h b/torchvision/csrc/cpu/ps_roi_pool_kernel.h index 14a4e22681a..2cefe39e11e 100644 --- a/torchvision/csrc/cpu/ps_roi_pool_kernel.h +++ b/torchvision/csrc/cpu/ps_roi_pool_kernel.h @@ -3,6 +3,9 @@ #include #include "../macros.h" +namespace vision { +namespace ops { + VISION_API std::tuple ps_roi_pool_forward_cpu( const at::Tensor& input, const at::Tensor& rois, @@ -21,3 +24,6 @@ VISION_API at::Tensor ps_roi_pool_backward_cpu( int64_t channels, int64_t height, int64_t width); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cpu/roi_align_kernel.cpp b/torchvision/csrc/cpu/roi_align_kernel.cpp index 133722fdc5e..cbb75f2c474 100644 --- a/torchvision/csrc/cpu/roi_align_kernel.cpp +++ b/torchvision/csrc/cpu/roi_align_kernel.cpp @@ -1,5 +1,8 @@ #include "roi_align_kernel.h" +namespace vision { +namespace ops { + namespace { // implementation taken from Caffe2 @@ -494,3 +497,6 @@ at::Tensor roi_align_backward_cpu( }); return grad_input; } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cpu/roi_align_kernel.h b/torchvision/csrc/cpu/roi_align_kernel.h index 79fd46bd44e..2e7813c261c 100644 --- a/torchvision/csrc/cpu/roi_align_kernel.h +++ b/torchvision/csrc/cpu/roi_align_kernel.h @@ -3,6 +3,9 @@ #include #include "../macros.h" +namespace vision { +namespace ops { + VISION_API at::Tensor roi_align_forward_cpu( const at::Tensor& input, const at::Tensor& rois, @@ -24,3 +27,6 @@ VISION_API at::Tensor roi_align_backward_cpu( int64_t width, int64_t sampling_ratio, bool aligned); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cpu/roi_pool_kernel.cpp b/torchvision/csrc/cpu/roi_pool_kernel.cpp index d622f2b430b..375b722684e 100644 --- a/torchvision/csrc/cpu/roi_pool_kernel.cpp +++ b/torchvision/csrc/cpu/roi_pool_kernel.cpp @@ -2,6 +2,9 @@ #include "roi_pool_kernel.h" +namespace vision { +namespace ops { + namespace { template @@ -231,3 +234,6 @@ at::Tensor roi_pool_backward_cpu( }); return grad_input; } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cpu/roi_pool_kernel.h b/torchvision/csrc/cpu/roi_pool_kernel.h index 66fd993d5b4..33d029cf31a 100644 --- a/torchvision/csrc/cpu/roi_pool_kernel.h +++ b/torchvision/csrc/cpu/roi_pool_kernel.h @@ -3,6 +3,9 @@ #include #include "../macros.h" +namespace vision { +namespace ops { + VISION_API std::tuple roi_pool_forward_cpu( const at::Tensor& input, const at::Tensor& rois, @@ -21,3 +24,6 @@ VISION_API at::Tensor roi_pool_backward_cpu( int64_t channels, int64_t height, int64_t width); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cuda/cuda_helpers.h b/torchvision/csrc/cuda/cuda_helpers.h index a82e1c86f87..cec4a183899 100644 --- a/torchvision/csrc/cuda/cuda_helpers.h +++ b/torchvision/csrc/cuda/cuda_helpers.h @@ -1,5 +1,8 @@ #pragma once +namespace vision { +namespace ops { + #define CUDA_1D_KERNEL_LOOP(i, n) \ for (int i = (blockIdx.x * blockDim.x) + threadIdx.x; i < (n); \ i += (blockDim.x * gridDim.x)) @@ -8,3 +11,6 @@ template constexpr __host__ __device__ inline integer ceil_div(integer n, integer m) { return (n + m - 1) / m; } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cuda/deform_conv2d_kernel.cu b/torchvision/csrc/cuda/deform_conv2d_kernel.cu index cef8124caf3..e530710863c 100644 --- a/torchvision/csrc/cuda/deform_conv2d_kernel.cu +++ b/torchvision/csrc/cuda/deform_conv2d_kernel.cu @@ -73,6 +73,9 @@ #include "cuda_helpers.h" #include "deform_conv2d_kernel.h" +namespace vision { +namespace ops { + namespace { const int kMaxParallelImgs = 32; @@ -1183,3 +1186,6 @@ deform_conv2d_backward_cuda( return std::make_tuple( grad_input, grad_weight, grad_offset, grad_mask, grad_bias); } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cuda/deform_conv2d_kernel.h b/torchvision/csrc/cuda/deform_conv2d_kernel.h index 00f3f3dc15d..b2e3dc3f17f 100644 --- a/torchvision/csrc/cuda/deform_conv2d_kernel.h +++ b/torchvision/csrc/cuda/deform_conv2d_kernel.h @@ -3,6 +3,9 @@ #include #include "../macros.h" +namespace vision { +namespace ops { + VISION_API at::Tensor deform_conv2d_forward_cuda( const at::Tensor& input, const at::Tensor& weight, @@ -37,3 +40,6 @@ VISION_API std:: int64_t n_weight_grps, int64_t n_offset_grps, bool use_mask); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cuda/nms_kernel.cu b/torchvision/csrc/cuda/nms_kernel.cu index ae244efebe7..b8d4b3ce0ec 100644 --- a/torchvision/csrc/cuda/nms_kernel.cu +++ b/torchvision/csrc/cuda/nms_kernel.cu @@ -4,6 +4,9 @@ #include "cuda_helpers.h" #include "nms_kernel.h" +namespace vision { +namespace ops { + namespace { int const threadsPerBlock = sizeof(unsigned long long) * 8; @@ -162,3 +165,6 @@ at::Tensor nms_cuda( {keep.narrow(/*dim=*/0, /*start=*/0, /*length=*/num_to_keep) .to(order_t.device(), keep.scalar_type())}); } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cuda/nms_kernel.h b/torchvision/csrc/cuda/nms_kernel.h index 1eceddaccf3..0d2c0838437 100644 --- a/torchvision/csrc/cuda/nms_kernel.h +++ b/torchvision/csrc/cuda/nms_kernel.h @@ -3,7 +3,13 @@ #include #include "../macros.h" +namespace vision { +namespace ops { + VISION_API at::Tensor nms_cuda( const at::Tensor& dets, const at::Tensor& scores, double iou_threshold); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cuda/ps_roi_align_kernel.cu b/torchvision/csrc/cuda/ps_roi_align_kernel.cu index 7c808580258..6b1e729b12d 100644 --- a/torchvision/csrc/cuda/ps_roi_align_kernel.cu +++ b/torchvision/csrc/cuda/ps_roi_align_kernel.cu @@ -5,6 +5,9 @@ #include "cuda_helpers.h" #include "ps_roi_align_kernel.h" +namespace vision { +namespace ops { + namespace { template @@ -434,3 +437,6 @@ at::Tensor ps_roi_align_backward_cuda( AT_CUDA_CHECK(cudaGetLastError()); return grad_input; } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cuda/ps_roi_align_kernel.h b/torchvision/csrc/cuda/ps_roi_align_kernel.h index 45a300d6711..c40e6fa55b1 100644 --- a/torchvision/csrc/cuda/ps_roi_align_kernel.h +++ b/torchvision/csrc/cuda/ps_roi_align_kernel.h @@ -3,6 +3,9 @@ #include #include "../macros.h" +namespace vision { +namespace ops { + VISION_API std::tuple ps_roi_align_forward_cuda( const at::Tensor& input, const at::Tensor& rois, @@ -23,3 +26,6 @@ VISION_API at::Tensor ps_roi_align_backward_cuda( int64_t channels, int64_t height, int64_t width); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cuda/ps_roi_pool_kernel.cu b/torchvision/csrc/cuda/ps_roi_pool_kernel.cu index ed0ed26484d..91fd25b4bb5 100644 --- a/torchvision/csrc/cuda/ps_roi_pool_kernel.cu +++ b/torchvision/csrc/cuda/ps_roi_pool_kernel.cu @@ -5,6 +5,9 @@ #include "cuda_helpers.h" #include "ps_roi_pool_kernel.h" +namespace vision { +namespace ops { + namespace { template @@ -270,3 +273,6 @@ at::Tensor ps_roi_pool_backward_cuda( AT_CUDA_CHECK(cudaGetLastError()); return grad_input; } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cuda/ps_roi_pool_kernel.h b/torchvision/csrc/cuda/ps_roi_pool_kernel.h index e97f0ee7065..21015d4693b 100644 --- a/torchvision/csrc/cuda/ps_roi_pool_kernel.h +++ b/torchvision/csrc/cuda/ps_roi_pool_kernel.h @@ -3,6 +3,9 @@ #include #include "../macros.h" +namespace vision { +namespace ops { + VISION_API std::tuple ps_roi_pool_forward_cuda( const at::Tensor& input, const at::Tensor& rois, @@ -21,3 +24,6 @@ VISION_API at::Tensor ps_roi_pool_backward_cuda( int64_t channels, int64_t height, int64_t width); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cuda/roi_align_kernel.cu b/torchvision/csrc/cuda/roi_align_kernel.cu index 195d8b067f4..59388faa6ad 100644 --- a/torchvision/csrc/cuda/roi_align_kernel.cu +++ b/torchvision/csrc/cuda/roi_align_kernel.cu @@ -5,6 +5,9 @@ #include "cuda_helpers.h" #include "roi_align_kernel.h" +namespace vision { +namespace ops { + namespace { template @@ -443,3 +446,6 @@ at::Tensor roi_align_backward_cuda( AT_CUDA_CHECK(cudaGetLastError()); return grad_input; } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cuda/roi_align_kernel.h b/torchvision/csrc/cuda/roi_align_kernel.h index 46054f04f38..71096201627 100644 --- a/torchvision/csrc/cuda/roi_align_kernel.h +++ b/torchvision/csrc/cuda/roi_align_kernel.h @@ -3,6 +3,9 @@ #include #include "../macros.h" +namespace vision { +namespace ops { + VISION_API at::Tensor roi_align_forward_cuda( const at::Tensor& input, const at::Tensor& rois, @@ -24,3 +27,6 @@ VISION_API at::Tensor roi_align_backward_cuda( int64_t width, int64_t sampling_ratio, bool aligned); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cuda/roi_pool_kernel.cu b/torchvision/csrc/cuda/roi_pool_kernel.cu index 782ecaf9eb3..a96e79c87a9 100644 --- a/torchvision/csrc/cuda/roi_pool_kernel.cu +++ b/torchvision/csrc/cuda/roi_pool_kernel.cu @@ -6,6 +6,9 @@ #include "cuda_helpers.h" #include "roi_pool_kernel.h" +namespace vision { +namespace ops { + namespace { template @@ -254,3 +257,6 @@ at::Tensor roi_pool_backward_cuda( AT_CUDA_CHECK(cudaGetLastError()); return grad_input; } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/cuda/roi_pool_kernel.h b/torchvision/csrc/cuda/roi_pool_kernel.h index 3a99f7521bd..71a649968db 100644 --- a/torchvision/csrc/cuda/roi_pool_kernel.h +++ b/torchvision/csrc/cuda/roi_pool_kernel.h @@ -3,6 +3,9 @@ #include #include "../macros.h" +namespace vision { +namespace ops { + VISION_API std::tuple roi_pool_forward_cuda( const at::Tensor& input, const at::Tensor& rois, @@ -21,3 +24,6 @@ VISION_API at::Tensor roi_pool_backward_cuda( int64_t channels, int64_t height, int64_t width); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/deform_conv2d.cpp b/torchvision/csrc/deform_conv2d.cpp index 74ba630537a..e8a416683f2 100644 --- a/torchvision/csrc/deform_conv2d.cpp +++ b/torchvision/csrc/deform_conv2d.cpp @@ -5,6 +5,9 @@ #include #endif +namespace vision { +namespace ops { + at::Tensor deform_conv2d( const at::Tensor& input, const at::Tensor& weight, @@ -361,3 +364,6 @@ deform_conv2d_backward_autograd( return std::make_tuple(result[0], result[1], result[2], result[3], result[4]); } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/deform_conv2d.h b/torchvision/csrc/deform_conv2d.h index 6adc77fb888..85675ee6bf2 100644 --- a/torchvision/csrc/deform_conv2d.h +++ b/torchvision/csrc/deform_conv2d.h @@ -9,6 +9,9 @@ #include "hip/deform_conv2d_kernel.h" #endif +namespace vision { +namespace ops { + // C++ Forward at::Tensor deform_conv2d( const at::Tensor& input, @@ -98,3 +101,6 @@ deform_conv2d_backward_autograd( int64_t groups, int64_t offset_groups, bool use_mask); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/models/alexnet.h b/torchvision/csrc/models/alexnet.h index 33ffe379a97..d2529c88882 100644 --- a/torchvision/csrc/models/alexnet.h +++ b/torchvision/csrc/models/alexnet.h @@ -1,7 +1,7 @@ #pragma once #include -#include "general.h" +#include "../macros.h" namespace vision { namespace models { diff --git a/torchvision/csrc/models/densenet.h b/torchvision/csrc/models/densenet.h index 22db45b719d..9358631e4ba 100644 --- a/torchvision/csrc/models/densenet.h +++ b/torchvision/csrc/models/densenet.h @@ -1,7 +1,7 @@ #pragma once #include -#include "general.h" +#include "../macros.h" namespace vision { namespace models { diff --git a/torchvision/csrc/models/general.h b/torchvision/csrc/models/general.h deleted file mode 100644 index 4463786b4bb..00000000000 --- a/torchvision/csrc/models/general.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#ifdef _WIN32 -#if defined(torchvision_EXPORTS) -#define VISION_API __declspec(dllexport) -#else -#define VISION_API __declspec(dllimport) -#endif -#else -#define VISION_API -#endif diff --git a/torchvision/csrc/models/googlenet.h b/torchvision/csrc/models/googlenet.h index d5192c7623f..3d4b3faf7e4 100644 --- a/torchvision/csrc/models/googlenet.h +++ b/torchvision/csrc/models/googlenet.h @@ -1,7 +1,7 @@ #pragma once #include -#include "general.h" +#include "../macros.h" namespace vision { namespace models { diff --git a/torchvision/csrc/models/inception.h b/torchvision/csrc/models/inception.h index 3f964e3103c..08f329fbc1b 100644 --- a/torchvision/csrc/models/inception.h +++ b/torchvision/csrc/models/inception.h @@ -1,7 +1,7 @@ #pragma once #include -#include "general.h" +#include "../macros.h" namespace vision { namespace models { diff --git a/torchvision/csrc/models/mnasnet.h b/torchvision/csrc/models/mnasnet.h index ae136cd5b30..e69559b2dd7 100644 --- a/torchvision/csrc/models/mnasnet.h +++ b/torchvision/csrc/models/mnasnet.h @@ -1,7 +1,7 @@ #pragma once #include -#include "general.h" +#include "../macros.h" namespace vision { namespace models { diff --git a/torchvision/csrc/models/mobilenet.h b/torchvision/csrc/models/mobilenet.h index 7e3f8596692..63d26474b23 100644 --- a/torchvision/csrc/models/mobilenet.h +++ b/torchvision/csrc/models/mobilenet.h @@ -1,7 +1,7 @@ #pragma once #include -#include "general.h" +#include "../macros.h" namespace vision { namespace models { diff --git a/torchvision/csrc/models/resnet.h b/torchvision/csrc/models/resnet.h index ee4a8cd5284..b8caf4332c6 100644 --- a/torchvision/csrc/models/resnet.h +++ b/torchvision/csrc/models/resnet.h @@ -1,7 +1,7 @@ #pragma once #include -#include "general.h" +#include "../macros.h" namespace vision { namespace models { diff --git a/torchvision/csrc/models/shufflenetv2.h b/torchvision/csrc/models/shufflenetv2.h index 8aa0ea69db4..ea8524c72fa 100644 --- a/torchvision/csrc/models/shufflenetv2.h +++ b/torchvision/csrc/models/shufflenetv2.h @@ -1,7 +1,7 @@ #pragma once #include -#include "general.h" +#include "../macros.h" namespace vision { namespace models { diff --git a/torchvision/csrc/models/squeezenet.h b/torchvision/csrc/models/squeezenet.h index 5cd3cb482e7..c43d2b07f13 100644 --- a/torchvision/csrc/models/squeezenet.h +++ b/torchvision/csrc/models/squeezenet.h @@ -1,7 +1,7 @@ #pragma once #include -#include "general.h" +#include "../macros.h" namespace vision { namespace models { diff --git a/torchvision/csrc/models/vgg.h b/torchvision/csrc/models/vgg.h index ea64dbfa151..4a540bea822 100644 --- a/torchvision/csrc/models/vgg.h +++ b/torchvision/csrc/models/vgg.h @@ -1,7 +1,7 @@ #pragma once #include -#include "general.h" +#include "../macros.h" namespace vision { namespace models { diff --git a/torchvision/csrc/new_empty_tensor_op.cpp b/torchvision/csrc/new_empty_tensor_op.cpp index e4f31600c54..768b5599bf9 100644 --- a/torchvision/csrc/new_empty_tensor_op.cpp +++ b/torchvision/csrc/new_empty_tensor_op.cpp @@ -3,6 +3,9 @@ #include "new_empty_tensor_op.h" #include +namespace vision { +namespace ops { + namespace { class NewEmptyTensorOp : public torch::autograd::Function { @@ -33,3 +36,6 @@ at::Tensor new_empty_tensor( const c10::List& shape) { return NewEmptyTensorOp::apply(input, shape)[0]; } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/new_empty_tensor_op.h b/torchvision/csrc/new_empty_tensor_op.h index 75f4cd5a7fe..f00cb67b779 100644 --- a/torchvision/csrc/new_empty_tensor_op.h +++ b/torchvision/csrc/new_empty_tensor_op.h @@ -2,6 +2,12 @@ #include +namespace vision { +namespace ops { + at::Tensor new_empty_tensor( const at::Tensor& input, const c10::List& shape); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/nms.cpp b/torchvision/csrc/nms.cpp index 075f3101937..2f9dbee9a32 100644 --- a/torchvision/csrc/nms.cpp +++ b/torchvision/csrc/nms.cpp @@ -5,6 +5,9 @@ #include #endif +namespace vision { +namespace ops { + at::Tensor nms( const at::Tensor& dets, const at::Tensor& scores, @@ -27,3 +30,6 @@ at::Tensor nms_autocast( iou_threshold); } #endif + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/nms.h b/torchvision/csrc/nms.h index 87b07548454..ac7cbc53caf 100644 --- a/torchvision/csrc/nms.h +++ b/torchvision/csrc/nms.h @@ -9,6 +9,9 @@ #include "hip/nms_kernel.h" #endif +namespace vision { +namespace ops { + // C++ Forward at::Tensor nms( const at::Tensor& dets, @@ -22,3 +25,6 @@ at::Tensor nms_autocast( const at::Tensor& scores, double iou_threshold); #endif + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/ps_roi_align.cpp b/torchvision/csrc/ps_roi_align.cpp index 0e1a30d6e63..5add21aaeec 100644 --- a/torchvision/csrc/ps_roi_align.cpp +++ b/torchvision/csrc/ps_roi_align.cpp @@ -5,6 +5,9 @@ #include #endif +namespace vision { +namespace ops { + std::tuple ps_roi_align( const at::Tensor& input, const at::Tensor& rois, @@ -218,3 +221,6 @@ at::Tensor ps_roi_align_backward_autograd( height, width)[0]; } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/ps_roi_align.h b/torchvision/csrc/ps_roi_align.h index 0f7ecea2f12..c21107df4f4 100644 --- a/torchvision/csrc/ps_roi_align.h +++ b/torchvision/csrc/ps_roi_align.h @@ -9,6 +9,9 @@ #include "hip/ps_roi_align_kernel.h" #endif +namespace vision { +namespace ops { + // C++ Forward std::tuple ps_roi_align( const at::Tensor& input, @@ -64,3 +67,6 @@ at::Tensor ps_roi_align_backward_autograd( int64_t channels, int64_t height, int64_t width); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/ps_roi_pool.cpp b/torchvision/csrc/ps_roi_pool.cpp index 76fb2d04be7..88a733a6369 100644 --- a/torchvision/csrc/ps_roi_pool.cpp +++ b/torchvision/csrc/ps_roi_pool.cpp @@ -5,6 +5,9 @@ #include #endif +namespace vision { +namespace ops { + std::tuple ps_roi_pool( const at::Tensor& input, const at::Tensor& rois, @@ -197,3 +200,6 @@ at::Tensor ps_roi_pool_backward_autograd( height, width)[0]; } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/ps_roi_pool.h b/torchvision/csrc/ps_roi_pool.h index 0c8baef4a9a..20ae17d3ad1 100644 --- a/torchvision/csrc/ps_roi_pool.h +++ b/torchvision/csrc/ps_roi_pool.h @@ -9,6 +9,9 @@ #include "hip/ps_roi_pool_kernel.h" #endif +namespace vision { +namespace ops { + // C++ Forward std::tuple ps_roi_pool( const at::Tensor& input, @@ -59,3 +62,6 @@ at::Tensor ps_roi_pool_backward_autograd( int64_t channels, int64_t height, int64_t width); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/roi_align.cpp b/torchvision/csrc/roi_align.cpp index 30eda8612d2..63643a6cb46 100644 --- a/torchvision/csrc/roi_align.cpp +++ b/torchvision/csrc/roi_align.cpp @@ -5,6 +5,9 @@ #include #endif +namespace vision { +namespace ops { + at::Tensor roi_align( const at::Tensor& input, // Input feature map. const at::Tensor& rois, // List of ROIs to pool over. @@ -227,3 +230,6 @@ at::Tensor roi_align_backward_autograd( sampling_ratio, aligned)[0]; } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/roi_align.h b/torchvision/csrc/roi_align.h index d9bae4ba2a1..1e92c8d2134 100644 --- a/torchvision/csrc/roi_align.h +++ b/torchvision/csrc/roi_align.h @@ -9,6 +9,9 @@ #include "hip/roi_align_kernel.h" #endif +namespace vision { +namespace ops { + // C++ Forward at::Tensor roi_align( const at::Tensor& input, @@ -67,3 +70,6 @@ at::Tensor roi_align_backward_autograd( int64_t width, int64_t sampling_ratio, bool aligned); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/roi_pool.cpp b/torchvision/csrc/roi_pool.cpp index c8d70bd8940..b2948e6dd23 100644 --- a/torchvision/csrc/roi_pool.cpp +++ b/torchvision/csrc/roi_pool.cpp @@ -5,6 +5,9 @@ #include #endif +namespace vision { +namespace ops { + std::tuple roi_pool( const at::Tensor& input, const at::Tensor& rois, @@ -196,3 +199,6 @@ at::Tensor roi_pool_backward_autograd( height, width)[0]; } + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/roi_pool.h b/torchvision/csrc/roi_pool.h index f528ce6d7e0..ac005914107 100644 --- a/torchvision/csrc/roi_pool.h +++ b/torchvision/csrc/roi_pool.h @@ -9,6 +9,9 @@ #include "hip/roi_pool_kernel.h" #endif +namespace vision { +namespace ops { + // C++ Forward std::tuple roi_pool( const at::Tensor& input, @@ -59,3 +62,6 @@ at::Tensor roi_pool_backward_autograd( int64_t channels, int64_t height, int64_t width); + +} // namespace ops +} // namespace vision diff --git a/torchvision/csrc/vision.cpp b/torchvision/csrc/vision.cpp index fb0bf014912..b24b6c3df45 100644 --- a/torchvision/csrc/vision.cpp +++ b/torchvision/csrc/vision.cpp @@ -1,3 +1,5 @@ +#include "vision.h" + #include #include @@ -35,6 +37,8 @@ int64_t cuda_version() noexcept { } } // namespace vision +using namespace vision::ops; + TORCH_LIBRARY(torchvision, m) { m.def( "deform_conv2d(Tensor input, Tensor weight, Tensor offset, Tensor mask, Tensor bias, int stride_h, int stride_w, int pad_h, int pad_w, int dilation_h, int dilation_w, int groups, int offset_groups, bool use_mask) -> Tensor"); diff --git a/torchvision/csrc/vision.h b/torchvision/csrc/vision.h index c99b25c030d..91935be6fdd 100644 --- a/torchvision/csrc/vision.h +++ b/torchvision/csrc/vision.h @@ -1,6 +1,5 @@ #pragma once -#include #include #include "macros.h"