Skip to content

Commit

Permalink
style: Autoformat
Browse files Browse the repository at this point in the history
  • Loading branch information
TomSchammo committed Nov 11, 2024
1 parent a53a7e4 commit 77a89da
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 27 deletions.
3 changes: 2 additions & 1 deletion cpp/include/tensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ using dimensions = struct {
* @returns a new tensor with 0 padding.
*/
[[nodiscard]] torch::Tensor
change_sparse_representation(const torch::Tensor &input, tensor_size_t batch_idx);
change_sparse_representation(const torch::Tensor &input,
tensor_size_t batch_idx);

#endif // !TENSOR_HPP
16 changes: 9 additions & 7 deletions cpp/include/transformations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ void scale_random(at::Tensor points, at::Tensor labels, float sigma,
*
* @param point_cloud is the point cloud that contains the points that will be
* scaled.
* @param labels are the labels belonging to the aforementioned point cloud.
* @param labels are the labels belonging to the aforementioned point
* cloud.
* @param sigma is the the standard deviation of the truncated normal
* distribution.
* @param max_scale is the upper limit of the truncated normal distribution. The
* lower limit is the inverse.
* @param max_scale is the upper limit of the truncated normal distribution.
* The lower limit is the inverse.
*/
void scale_local(at::Tensor point_cloud, at::Tensor labels, float sigma,
float max_scale);
Expand Down Expand Up @@ -122,8 +123,7 @@ void rotate_random(at::Tensor points, at::Tensor labels, float sigma);
*/
[[nodiscard]] std::pair<torch::Tensor, torch::Tensor>
delete_labels_by_min_points(const at::Tensor &points, const at::Tensor &labels,
const at::Tensor &names,
tensor_size_t min_points);
const at::Tensor &names, tensor_size_t min_points);

/**
* Checks the amount of points for each bounding box.
Expand All @@ -144,7 +144,8 @@ delete_labels_by_min_points(const at::Tensor &points, const at::Tensor &labels,
*/
[[nodiscard]] inline std::pair<torch::Tensor, torch::Tensor>
_delete_labels_by_min_points(const at::Tensor &points, const at::Tensor &labels,
const at::Tensor &names, const tensor_size_t min_points,
const at::Tensor &names,
const tensor_size_t min_points,
const tensor_size_t batch_idx) {

const tensor_size_t num_labels = labels.size(0);
Expand All @@ -153,7 +154,8 @@ _delete_labels_by_min_points(const at::Tensor &points, const at::Tensor &labels,
const tensor_size_t label_features = labels.size(1);
const tensor_size_t name_features = names.size(1);

const auto point_indices = torch::zeros({num_labels, num_points}, torch::kI32);
const auto point_indices =
torch::zeros({num_labels, num_points}, torch::kI32);
points_in_boxes_cpu(
labels.contiguous(),
points.index({torch::indexing::Slice(), torch::indexing::Slice(0, 3)})
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ change_sparse_representation(const torch::Tensor &input,
};

auto gather_tensors = [num_tensors, num_features](
const torch::Tensor &in, const tensor_size_t batch_idx_,
const torch::Tensor &in,
const tensor_size_t batch_idx_,
const size_t num_batches, tensor_size_t max_count) {
std::vector<torch::Tensor> batch;
batch.reserve(num_batches);
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/transformations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,8 @@ local_to_local_transform(const torch::Tensor &from_pose,
const torch::Tensor &to_pose) {

const auto local_to_world = local_to_world_transform(from_pose);
const auto world_to_local = torch::linalg_inv(local_to_world_transform(to_pose));
const auto world_to_local =
torch::linalg_inv(local_to_world_transform(to_pose));

return world_to_local.mm(local_to_world);
}
Expand Down
22 changes: 11 additions & 11 deletions cpp/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ namespace torch_utils {

[[nodiscard]] torch::Tensor boxes_to_corners(const torch::Tensor &boxes) {

const auto t = torch::tensor({
{1, -1, -1},
{1, 1, -1},
{-1, 1, -1},
{-1, -1, -1},
{1, -1, 1},
{1, 1, 1},
{-1, 1, 1},
{-1, -1, 1},
}) /
2;
const auto t = torch::tensor({
{1, -1, -1},
{1, 1, -1},
{-1, 1, -1},
{-1, -1, -1},
{1, -1, 1},
{1, 1, 1},
{-1, 1, 1},
{-1, -1, 1},
}) /
2;

auto corners = boxes.index({Slice(), None, Slice(3, 6)}).repeat({1, 8, 1}) *
t.index({None, Slice(), Slice()});
Expand Down
10 changes: 4 additions & 6 deletions cpp/src/weather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ calculate_factors(const fog_parameter metric, const float viewing_dist) {

[[nodiscard]] std::optional<std::vector<torch::Tensor>>
fog(const torch::Tensor &point_cloud, const float prob,
const fog_parameter metric,
const float sigma, const int mean) {
const fog_parameter metric, const float sigma, const int mean) {

auto rng = get_rng();
std::uniform_real_distribution<float> distrib(0, HUNDRED_PERCENT - 1);
Expand Down Expand Up @@ -74,8 +73,7 @@ fog(const torch::Tensor &point_cloud, const float prob,

[[nodiscard]] torch::Tensor
fog(torch::Tensor point_cloud, const fog_parameter metric,
const float viewing_dist,
point_cloud_data::intensity_range max_intensity) {
const float viewing_dist, point_cloud_data::intensity_range max_intensity) {

const auto [extinction_factor, beta, delete_probability] =
calculate_factors(metric, viewing_dist);
Expand Down Expand Up @@ -247,8 +245,8 @@ void universal_weather(torch::Tensor point_cloud, const float prob,
const float sigma, const int mean, const float ext_a,
const float ext_b, const float beta_a,
const float beta_b, const float del_a, const float del_b,
const int int_a,
const int int_b, const int mean_int, const int int_range) {
const int int_a, const int int_b, const int mean_int,
const int int_range) {

auto rng = get_rng();
std::uniform_real_distribution<float> distrib(0, HUNDRED_PERCENT - 1);
Expand Down

0 comments on commit 77a89da

Please sign in to comment.