Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

ps_roi_pool.cpp 3.1 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
  1. #include "ps_roi_pool.h"
  2. #include <ATen/core/dispatch/Dispatcher.h>
  3. #include <torch/library.h>
  4. #include <torch/types.h>
  5. namespace vision {
  6. namespace ops {
  7. std::tuple<at::Tensor, at::Tensor> ps_roi_pool(
  8. const at::Tensor& input,
  9. const at::Tensor& rois,
  10. double spatial_scale,
  11. int64_t pooled_height,
  12. int64_t pooled_width) {
  13. C10_LOG_API_USAGE_ONCE("torchvision.csrc.ops.ps_roi_pool.ps_roi_pool");
  14. static auto op = c10::Dispatcher::singleton()
  15. .findSchemaOrThrow("torchvision::ps_roi_pool", "")
  16. .typed<decltype(ps_roi_pool)>();
  17. return op.call(input, rois, spatial_scale, pooled_height, pooled_width);
  18. }
  19. std::tuple<at::Tensor, at::Tensor> ps_roi_pool_symint(
  20. const at::Tensor& input,
  21. const at::Tensor& rois,
  22. double spatial_scale,
  23. c10::SymInt pooled_height,
  24. c10::SymInt pooled_width) {
  25. C10_LOG_API_USAGE_ONCE("torchvision.csrc.ops.ps_roi_pool.ps_roi_pool");
  26. static auto op = c10::Dispatcher::singleton()
  27. .findSchemaOrThrow("torchvision::ps_roi_pool", "")
  28. .typed<decltype(ps_roi_pool_symint)>();
  29. return op.call(input, rois, spatial_scale, pooled_height, pooled_width);
  30. }
  31. namespace detail {
  32. at::Tensor _ps_roi_pool_backward(
  33. const at::Tensor& grad,
  34. const at::Tensor& rois,
  35. const at::Tensor& channel_mapping,
  36. double spatial_scale,
  37. int64_t pooled_height,
  38. int64_t pooled_width,
  39. int64_t batch_size,
  40. int64_t channels,
  41. int64_t height,
  42. int64_t width) {
  43. static auto op =
  44. c10::Dispatcher::singleton()
  45. .findSchemaOrThrow("torchvision::_ps_roi_pool_backward", "")
  46. .typed<decltype(_ps_roi_pool_backward)>();
  47. return op.call(
  48. grad,
  49. rois,
  50. channel_mapping,
  51. spatial_scale,
  52. pooled_height,
  53. pooled_width,
  54. batch_size,
  55. channels,
  56. height,
  57. width);
  58. }
  59. at::Tensor _ps_roi_pool_backward_symint(
  60. const at::Tensor& grad,
  61. const at::Tensor& rois,
  62. const at::Tensor& channel_mapping,
  63. double spatial_scale,
  64. c10::SymInt pooled_height,
  65. c10::SymInt pooled_width,
  66. c10::SymInt batch_size,
  67. c10::SymInt channels,
  68. c10::SymInt height,
  69. c10::SymInt width) {
  70. static auto op =
  71. c10::Dispatcher::singleton()
  72. .findSchemaOrThrow("torchvision::_ps_roi_pool_backward", "")
  73. .typed<decltype(_ps_roi_pool_backward_symint)>();
  74. return op.call(
  75. grad,
  76. rois,
  77. channel_mapping,
  78. spatial_scale,
  79. pooled_height,
  80. pooled_width,
  81. batch_size,
  82. channels,
  83. height,
  84. width);
  85. }
  86. } // namespace detail
  87. TORCH_LIBRARY_FRAGMENT(torchvision, m) {
  88. m.def(TORCH_SELECTIVE_SCHEMA(
  89. "torchvision::ps_roi_pool(Tensor input, Tensor rois, float spatial_scale, SymInt pooled_height, SymInt pooled_width) -> (Tensor, Tensor)"));
  90. m.def(TORCH_SELECTIVE_SCHEMA(
  91. "torchvision::_ps_roi_pool_backward(Tensor grad, Tensor rois, Tensor channel_mapping, float spatial_scale, SymInt pooled_height, SymInt pooled_width, SymInt batch_size, SymInt channels, SymInt height, SymInt width) -> Tensor"));
  92. }
  93. } // namespace ops
  94. } // namespace vision
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...