Commit 99d0792e authored by rusty1s's avatar rusty1s
Browse files

fix for pytorch 1.6.0

parent 8f5a1e3a
...@@ -32,13 +32,13 @@ torch::Tensor grid_cpu(torch::Tensor pos, torch::Tensor size, ...@@ -32,13 +32,13 @@ torch::Tensor grid_cpu(torch::Tensor pos, torch::Tensor size,
pos = pos - start.unsqueeze(0); 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 = num_voxels.cumprod(0);
num_voxels = num_voxels =
torch::cat({torch::ones(1, num_voxels.options()), num_voxels}, 0); torch::cat({torch::ones(1, num_voxels.options()), num_voxels}, 0);
num_voxels = num_voxels.narrow(0, 0, size.size(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 *= num_voxels.view({1, -1});
out = out.sum(1); out = out.sum(1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment