Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version fix #3176

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mmcv/ops/csrc/pytorch/npu/bbox_overlaps_npu.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "common_util.h"
#include "pytorch_npu_helper.hpp"

using namespace NPU_NAME_SPACE;
Expand All @@ -24,7 +25,7 @@ void bbox_overlaps_npu(const Tensor bboxes1, const Tensor bboxes2, Tensor ious,
bboxesFP32 = bboxesFP32.to(at::kFloat);
gtboxesFP32 = gtboxesFP32.to(at::kFloat);
}
c10::SmallVector<int64_t, SIZE> iousSize = {gtboxesFP32.size(0),
c10::SmallVector<int64_t, 8> iousSize = {gtboxesFP32.size(0),
bboxesFP32.size(0)};
if (aligned) {
iousSize = {gtboxesFP32.size(0), 1};
Expand Down
7 changes: 0 additions & 7 deletions mmcv/ops/csrc/pytorch/npu/common_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@
#define MMCV_OPS_CSRC_COMMON__UTIL_HPP_
const int SIZE = 8;

c10::SmallVector<int64_t, SIZE> array_to_vector(c10::IntArrayRef shape) {
c10::SmallVector<int64_t, SIZE> shape_small_vec;
for (uint64_t i = 0; i < shape.size(); i++) {
shape_small_vec.emplace_back(shape[i]);
}
}

#endif // MMCV_OPS_CSRC_COMMON__UTIL_HPP_
3 changes: 2 additions & 1 deletion mmcv/ops/csrc/pytorch/npu/fused_bias_leakyrelu_npu.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "common_util.h"
#include "pytorch_npu_helper.hpp"

using namespace NPU_NAME_SPACE;
Expand All @@ -15,7 +16,7 @@ Tensor fused_bias_leakyrelu_npu(const Tensor &input, const Tensor &bias,
if (grad == 0) {
auto input_size = input.sizes();
int input_length = input_size.size();
c10::SmallVector<int64_t, SIZE> input_size_tmp;
c10::SmallVector<int64_t, 8> input_size_tmp;
for (uint64_t i = 0; i < input_size.size(); i++) {
input_size_tmp.emplace_back(input_size[i]);
}
Expand Down
3 changes: 2 additions & 1 deletion mmcv/ops/csrc/pytorch/npu/nms_npu.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "common_util.h"
#include "pytorch_npu_helper.hpp"

using namespace NPU_NAME_SPACE;
Expand All @@ -14,7 +15,7 @@ Tensor nms_npu(Tensor boxes, Tensor scores, float iou_threshold, int offset) {
at::Tensor max_outputsize_y =
at::empty({}, boxes.options().dtype(at::kInt)).fill_(boxes.size(0));

c10::SmallVector<int64_t, SIZE> outputsize = {boxes.size(0)};
c10::SmallVector<int64_t, 8> outputsize = {boxes.size(0)};
at::Tensor output =
at::empty(outputsize, boxes.options().dtype(at::kInt)).fill_(-1);
OpCommand cmd;
Expand Down
3 changes: 2 additions & 1 deletion mmcv/ops/csrc/pytorch/npu/nms_rotated_npu.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "common_util.h"
#include "pytorch_npu_helper.hpp"

using namespace NPU_NAME_SPACE;
Expand All @@ -11,7 +12,7 @@ Tensor nms_rotated_npu(const Tensor dets, const Tensor scores,
detsCast = detsCast.to(at::kFloat);
scoresCast = scoresCast.to(at::kFloat);
}
c10::SmallVector<int64_t, SIZE> selectedIndexSize = {dets.size(0)};
c10::SmallVector<int64_t, 8> selectedIndexSize = {dets.size(0)};

at::Tensor selectedBox = at::empty_like(dets);
at::Tensor selectedIndex =
Expand Down
3 changes: 2 additions & 1 deletion mmcv/ops/csrc/pytorch/npu/roi_align_npu.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "common_util.h"
#include "pytorch_npu_helper.hpp"

using namespace NPU_NAME_SPACE;
Expand Down Expand Up @@ -42,7 +43,7 @@ void roi_align_backward_npu(Tensor grad_output, Tensor rois, Tensor argmax_y,
roi_end_mode = 0;
}
auto shape = grad_input.sizes();
c10::SmallVector<int64_t, SIZE> xdiff_shape;
c10::SmallVector<int64_t, 8> xdiff_shape;
for (uint64_t i = 0; i < shape.size(); i++) {
xdiff_shape.emplace_back(shape[i]);
}
Expand Down
3 changes: 2 additions & 1 deletion mmcv/ops/csrc/pytorch/npu/roi_align_rotated_npu.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "common_util.h"
#include "pytorch_npu_helper.hpp"

using namespace NPU_NAME_SPACE;
Expand Down Expand Up @@ -32,7 +33,7 @@ void roi_align_rotated_backward_npu(Tensor top_grad, Tensor rois,
int64_t aligned_height_64 = aligned_height;
int64_t aligned_width_64 = aligned_width;
int64_t sampling_ratio_64 = sampling_ratio;
c10::SmallVector<int64_t, SIZE> y_grad_shape;
c10::SmallVector<int64_t, 8> y_grad_shape;
auto shape = bottom_grad.sizes();
for (uint64_t i = 0; i < shape.size(); i++) {
y_grad_shape.emplace_back(shape[i]);
Expand Down
3 changes: 2 additions & 1 deletion mmcv/ops/csrc/pytorch/npu/roipoint_pool3d_forward.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "common_util.h"
#include "pytorch_npu_helper.hpp"

using namespace NPU_NAME_SPACE;
Expand All @@ -12,7 +13,7 @@ void roipoint_pool3d_forward_impl_npu(int batch_size, int pts_num,
Tensor pooled_empty_flag) {
auto points_trans = xyz.transpose(1, 2).contiguous();
auto point_features_trans = pts_feature.transpose(1, 2).contiguous();
c10::SmallVector<int64_t, SIZE> features_trans_size = {
c10::SmallVector<int64_t, 8> features_trans_size = {
xyz.size(0), boxes3d.size(1), xyz.size(2) + pts_feature.size(2),
sampled_pts_num};
at::Tensor pooled_features_trans =
Expand Down
Loading