Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
MMCV
Commits
50d1fffb
"src/client/Client.hpp" did not exist on "b56d4817d2451dae213a3439aa581550b92e57b6"
Unverified
Commit
50d1fffb
authored
Jun 09, 2023
by
liuhw
Committed by
GitHub
Jun 09, 2023
Browse files
[Fix] Keep the shape of iou op's parameter 2 smaller than parameter 1 (#2821)
parent
f7382417
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
mmcv/ops/csrc/pytorch/npu/bbox_overlaps_npu.cpp
mmcv/ops/csrc/pytorch/npu/bbox_overlaps_npu.cpp
+9
-2
No files found.
mmcv/ops/csrc/pytorch/npu/bbox_overlaps_npu.cpp
View file @
50d1fffb
...
...
@@ -12,11 +12,17 @@ void bbox_overlaps_npu(const Tensor bboxes1, const Tensor bboxes2, Tensor ious,
if
(
mode
==
1
)
{
modeStr
=
"iof"
;
}
bool
swap_flag
=
false
;
at
::
Tensor
bboxesFP32
=
bboxes2
;
at
::
Tensor
gtboxesFP32
=
bboxes1
;
if
(
bboxes2
.
size
(
0
)
<
bboxes1
.
size
(
0
))
{
swap_flag
=
true
;
bboxesFP32
=
bboxes1
;
gtboxesFP32
=
bboxes2
;
}
if
(
bboxes2
.
scalar_type
()
!=
at
::
ScalarType
::
Float
)
{
bboxesFP32
=
NPUNativeFunctions
::
npu_dtype_cast
(
bboxes2
,
at
::
kFloat
);
gtboxesFP32
=
NPUNativeFunctions
::
npu_dtype_cast
(
b
boxes
1
,
at
::
kFloat
);
bboxesFP32
=
NPUNativeFunctions
::
npu_dtype_cast
(
bboxes
FP3
2
,
at
::
kFloat
);
gtboxesFP32
=
NPUNativeFunctions
::
npu_dtype_cast
(
gt
boxes
FP32
,
at
::
kFloat
);
}
c10
::
SmallVector
<
int64_t
,
SIZE
>
iousSize
=
{
gtboxesFP32
.
size
(
0
),
bboxesFP32
.
size
(
0
)};
...
...
@@ -38,6 +44,7 @@ void bbox_overlaps_npu(const Tensor bboxes1, const Tensor bboxes2, Tensor ious,
if
(
bboxes2
.
scalar_type
()
!=
at
::
ScalarType
::
Float
)
{
iousFP32
=
NPUNativeFunctions
::
npu_dtype_cast
(
iousFP32
,
at
::
kHalf
);
}
iousFP32
=
swap_flag
?
iousFP32
.
transpose
(
0
,
1
)
:
iousFP32
;
ious
.
copy_
(
iousFP32
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment