Skip to content

Commit

Permalink
perf: Improve performance of trace_beam
Browse files Browse the repository at this point in the history
Replace manual indexing of tensor elements with slicing, thereby
increasing the performance of rain simulations by ~33%
(saving on average ~90 seconds).
  • Loading branch information
TomSchammo committed Nov 17, 2024
1 parent 0769192 commit 86a2fc3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions cpp/src/raytracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ constexpr tensor_size_t min_intersect_dist = 1;
i < split_index[index + 1].item<tensor_size_t>(); i++) {
const auto nf = noise_filter[i];

const auto sphere = torch::tensor(
{nf[0].item<float>(), nf[1].item<float>(), nf[2].item<float>()});
const auto sphere = nf.index({Slice(0, 3)});

const auto nf3_val = nf[3].item<float>();

Expand Down

0 comments on commit 86a2fc3

Please sign in to comment.