Skip to content

Commit

Permalink
fix: avoid powf
Browse files Browse the repository at this point in the history
Signed-off-by: tzhong518 <[email protected]>
  • Loading branch information
tzhong518 committed Apr 4, 2024
1 parent 44ded7a commit 8a23731
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,12 @@ __global__ void generateBoxes3D_kernel(
det_boxes3d[idx].length_variance = expf(l_variance);
det_boxes3d[idx].width_variance = expf(w_variance);
det_boxes3d[idx].height_variance = expf(h_variance);
det_boxes3d[idx].yaw_variance = (powf(yaw_cos, 2) * expf(yaw_sin_log_variance) +
powf(yaw_sin, 2) * expf(yaw_cos_log_variance)) /
(powf((powf(yaw_sin, 2) + powf(yaw_cos, 2)), 2));
const float yaw_sin_sq = yaw_sin * yaw_sin;
const float yaw_cos_sq = yaw_cos * yaw_cos;
const float yaw_norm_sq = (yaw_sin_sq + yaw_cos_sq) * (yaw_sin_sq + yaw_cos_sq);
det_boxes3d[idx].yaw_variance =
(yaw_cos_sq * expf(yaw_sin_log_variance) + yaw_sin_sq * expf(yaw_cos_log_variance)) /
yaw_norm_sq;
det_boxes3d[idx].vel_x_variance = expf(vel_x_variance);
det_boxes3d[idx].vel_y_variance = expf(vel_y_variance);
}
Expand Down

0 comments on commit 8a23731

Please sign in to comment.