Skip to content

Commit

Permalink
fix for pytorch 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rusty1s committed Aug 5, 2020
1 parent 8f5a1e3 commit 99d0792
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions csrc/cpu/grid_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ torch::Tensor grid_cpu(torch::Tensor pos, torch::Tensor size,

pos = pos - start.unsqueeze(0);

auto num_voxels = ((end - start) / size).toType(torch::kLong) + 1;
auto num_voxels = (end - start).true_divide(size).toType(torch::kLong) + 1;
num_voxels = num_voxels.cumprod(0);
num_voxels =
torch::cat({torch::ones(1, num_voxels.options()), num_voxels}, 0);
num_voxels = num_voxels.narrow(0, 0, size.size(0));

auto out = (pos / size.view({1, -1})).toType(torch::kLong);
auto out = pos.true_divide(size.view({1, -1})).toType(torch::kLong);
out *= num_voxels.view({1, -1});
out = out.sum(1);

Expand Down

0 comments on commit 99d0792

Please sign in to comment.