Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using octree with multiscale_type='cat' #71

Open
patmjen opened this issue Nov 11, 2022 · 1 comment
Open

Error using octree with multiscale_type='cat' #71

patmjen opened this issue Nov 11, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@patmjen
Copy link

patmjen commented Nov 11, 2022

First, thank you for the great library!

Using OctreeGrid with multiscale_type='cat' gave me an error when calling interpolate at L273

return feats.reshape(batch, num_samples, self.feature_dim)

The problem is that self.feature_dim is too small as the entries have self.feature_dim * num_feats dimensions.

I changed the code as follows, which seemed to fix it.

diff --git a/wisp/models/grids/octree_grid.py b/wisp/models/grids/octree_grid.py
index 7c6a8bc..95ec5e3 100644
--- a/wisp/models/grids/octree_grid.py
+++ b/wisp/models/grids/octree_grid.py
@@ -263,14 +263,17 @@ class OctreeGrid(BLASGrid):

             if self.multiscale_type == 'sum':
                 feats = feats.reshape(*feats.shape[:-1], num_feats, self.feature_dim)
+                out_features = self.feature_dim
                 if self.training:
                     feats = feats.sum(-2)
                 else:
                     feats = feats.sum(-2)
+            else:  # self.multiscale_type == 'cat'
+                out_features = self.feature_dim * num_feats

             timer.check("aggregate")

-            return feats.reshape(batch, num_samples, self.feature_dim)
+            return feats.reshape(batch, num_samples, out_features)

     def raymarch(self, rays, level=None, num_samples=64, raymarch_type='voxel'):
         """Mostly a wrapper over OctreeAS.raymarch. See corresponding function for more details.
@orperel orperel added the bug Something isn't working label Dec 4, 2022
@orperel
Copy link
Collaborator

orperel commented Dec 4, 2022

Thanks a lot for reporting this one @patmjen ! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants