"git@developer.sourcefind.cn:OpenDAS/dynamo.git" did not exist on "62a0f136662b9f8fb30066a535b854eab26c6e9f"
Unverified Commit 725c59fd authored by Martin Hahner's avatar Martin Hahner Committed by GitHub
Browse files

Fix issue if there are less than half of NUM_KEYPOINTS (#534)

If there are less than half of model_cfg.NUM_KEYPOINTS it will lead to 
RuntimeError: unsupported operation: some elements of the input tensor and the written-to tensor refer to a single memory location. 
Please clone() the tensor before performing the operation.
parent e4d2b75b
...@@ -141,8 +141,9 @@ class VoxelSetAbstraction(nn.Module): ...@@ -141,8 +141,9 @@ class VoxelSetAbstraction(nn.Module):
).long() ).long()
if sampled_points.shape[1] < self.model_cfg.NUM_KEYPOINTS: if sampled_points.shape[1] < self.model_cfg.NUM_KEYPOINTS:
empty_num = self.model_cfg.NUM_KEYPOINTS - sampled_points.shape[1] times = int(self.model_cfg.NUM_KEYPOINTS / sampled_points.shape[1]) + 1
cur_pt_idxs[0, -empty_num:] = cur_pt_idxs[0, :empty_num] non_empty = cur_pt_idxs[0, :sampled_points.shape[1]]
cur_pt_idxs[0] = non_empty.repeat(times)[:self.model_cfg.NUM_KEYPOINTS]
keypoints = sampled_points[0][cur_pt_idxs[0]].unsqueeze(dim=0) keypoints = sampled_points[0][cur_pt_idxs[0]].unsqueeze(dim=0)
......
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