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
OpenPCDet
Commits
684dc231
Commit
684dc231
authored
Dec 26, 2021
by
Shaoshuai Shi
Browse files
update torch.div and torch.meshgrid to remove warning
parent
46d558ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
pcdet/models/model_utils/centernet_utils.py
pcdet/models/model_utils/centernet_utils.py
+2
-2
pcdet/ops/pointnet2/pointnet2_stack/pointnet2_modules.py
pcdet/ops/pointnet2/pointnet2_stack/pointnet2_modules.py
+1
-1
No files found.
pcdet/models/model_utils/centernet_utils.py
View file @
684dc231
...
@@ -139,11 +139,11 @@ def _topk(scores, K=40):
...
@@ -139,11 +139,11 @@ def _topk(scores, K=40):
topk_scores
,
topk_inds
=
torch
.
topk
(
scores
.
flatten
(
2
,
3
),
K
)
topk_scores
,
topk_inds
=
torch
.
topk
(
scores
.
flatten
(
2
,
3
),
K
)
topk_inds
=
topk_inds
%
(
height
*
width
)
topk_inds
=
topk_inds
%
(
height
*
width
)
topk_ys
=
(
topk_inds
//
width
).
float
()
topk_ys
=
torch
.
div
(
topk_inds
,
width
,
rounding_mode
=
'floor'
).
float
()
topk_xs
=
(
topk_inds
%
width
).
int
().
float
()
topk_xs
=
(
topk_inds
%
width
).
int
().
float
()
topk_score
,
topk_ind
=
torch
.
topk
(
topk_scores
.
view
(
batch
,
-
1
),
K
)
topk_score
,
topk_ind
=
torch
.
topk
(
topk_scores
.
view
(
batch
,
-
1
),
K
)
topk_classes
=
(
topk_ind
//
K
).
int
()
topk_classes
=
torch
.
div
(
topk_ind
,
K
,
rounding_mode
=
'floor'
).
int
()
topk_inds
=
_gather_feat
(
topk_inds
.
view
(
batch
,
-
1
,
1
),
topk_ind
).
view
(
batch
,
K
)
topk_inds
=
_gather_feat
(
topk_inds
.
view
(
batch
,
-
1
,
1
),
topk_ind
).
view
(
batch
,
K
)
topk_ys
=
_gather_feat
(
topk_ys
.
view
(
batch
,
-
1
,
1
),
topk_ind
).
view
(
batch
,
K
)
topk_ys
=
_gather_feat
(
topk_ys
.
view
(
batch
,
-
1
,
1
),
topk_ind
).
view
(
batch
,
K
)
topk_xs
=
_gather_feat
(
topk_xs
.
view
(
batch
,
-
1
,
1
),
topk_ind
).
view
(
batch
,
K
)
topk_xs
=
_gather_feat
(
topk_xs
.
view
(
batch
,
-
1
,
1
),
topk_ind
).
view
(
batch
,
K
)
...
...
pcdet/ops/pointnet2/pointnet2_stack/pointnet2_modules.py
View file @
684dc231
...
@@ -349,7 +349,7 @@ class VectorPoolAggregationModule(nn.Module):
...
@@ -349,7 +349,7 @@ class VectorPoolAggregationModule(nn.Module):
x_grids
=
torch
.
arange
(
-
R
+
R
/
num_voxels
[
0
],
R
-
R
/
num_voxels
[
0
]
+
1e-5
,
2
*
R
/
num_voxels
[
0
],
device
=
device
)
x_grids
=
torch
.
arange
(
-
R
+
R
/
num_voxels
[
0
],
R
-
R
/
num_voxels
[
0
]
+
1e-5
,
2
*
R
/
num_voxels
[
0
],
device
=
device
)
y_grids
=
torch
.
arange
(
-
R
+
R
/
num_voxels
[
1
],
R
-
R
/
num_voxels
[
1
]
+
1e-5
,
2
*
R
/
num_voxels
[
1
],
device
=
device
)
y_grids
=
torch
.
arange
(
-
R
+
R
/
num_voxels
[
1
],
R
-
R
/
num_voxels
[
1
]
+
1e-5
,
2
*
R
/
num_voxels
[
1
],
device
=
device
)
z_grids
=
torch
.
arange
(
-
R
+
R
/
num_voxels
[
2
],
R
-
R
/
num_voxels
[
2
]
+
1e-5
,
2
*
R
/
num_voxels
[
2
],
device
=
device
)
z_grids
=
torch
.
arange
(
-
R
+
R
/
num_voxels
[
2
],
R
-
R
/
num_voxels
[
2
]
+
1e-5
,
2
*
R
/
num_voxels
[
2
],
device
=
device
)
x_offset
,
y_offset
,
z_offset
=
torch
.
meshgrid
(
x_grids
,
y_grids
,
z_grids
)
# shape: [num_x, num_y, num_z]
x_offset
,
y_offset
,
z_offset
=
torch
.
meshgrid
(
x_grids
,
y_grids
,
z_grids
,
indexing
=
'ij'
)
# shape: [num_x, num_y, num_z]
xyz_offset
=
torch
.
cat
((
xyz_offset
=
torch
.
cat
((
x_offset
.
contiguous
().
view
(
-
1
,
1
),
x_offset
.
contiguous
().
view
(
-
1
,
1
),
y_offset
.
contiguous
().
view
(
-
1
,
1
),
y_offset
.
contiguous
().
view
(
-
1
,
1
),
...
...
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