Skip to content

Commit

Permalink
Perception: add log information
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroldchen authored and jinghaomiao committed Sep 17, 2020
1 parent 8456b8d commit 802ce39
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ cc_library(
":postprocess_cuda",
":preprocess_points",
":scatter_cuda",
"//cyber/common",
"//modules/perception/common:perception_gflags",
"//third_party:libtorch",
"@local_config_cuda//cuda:cudart",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include <chrono>
#include <iostream>

#include "cyber/common/log.h"

// headers in local files
#include "modules/perception/lidar/lib/detection/lidar_point_pillars/point_pillars.h"

Expand Down Expand Up @@ -614,6 +616,11 @@ void PointPillars::DoInference(const float* in_points_array,
const int in_num_points,
std::vector<float>* out_detections,
std::vector<int>* out_labels) {
if (device_id_ < 0) {
AERROR << "Torch is not using GPU!";
return;
}

Preprocess(in_points_array, in_num_points);

anchor_mask_cuda_ptr_->DoAnchorMaskCuda(
Expand Down Expand Up @@ -643,13 +650,9 @@ void PointPillars::DoInference(const float* in_points_array,
{kMaxNumPillars, 4}, torch::kCUDA);

torch::Device device(device_type_, device_id_);
if (device_id_ >= 0) {
tensor_pillar_point_feature.to(device);
tensor_num_points_per_pillar.to(device);
tensor_pillar_coors.to(device);
} else {
return;
}
tensor_pillar_point_feature.to(device);
tensor_num_points_per_pillar.to(device);
tensor_pillar_coors.to(device);

auto pfe_output = pfe_net_.forward({tensor_pillar_point_feature,
tensor_num_points_per_pillar,
Expand Down

0 comments on commit 802ce39

Please sign in to comment.