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

How does the trilinear interpolation work if the dimensions don't match? #25

Open
jayrmh opened this issue Dec 2, 2022 · 4 comments
Open

Comments

@jayrmh
Copy link

jayrmh commented Dec 2, 2022

Hey, i am stuck with this error at the function: def trilinear_interp(self, x, voxel_min_vertex, voxel_max_vertex, voxel_embedds) in class HashEmbedder(nn.Module):

RuntimeError: The size of tensor a (2) must match the size of tensor b (3) at non-singleton dimension 2
Emerging at the following line:

c00 = voxel_embedds[:,0]*(1-weights[:,0][:,None]) + voxel_embedds[:,4]*weights[:,0][:,None]

My input was a 3D coordinate, [X, Y, Z], and I do not see where I can reshape or change, because its the voxel embedding that is the problem:

Considering an input with 3 dimensions, and the hash embedding having 2 dimensions, how does this even work? The following is the specs in the function itself:

  • x: B x 3
  • voxel_min_vertex: B x 3
  • voxel_max_vertex: B x 3
  • voxel_embedds: B x 8 x 2
  • weights = (x - voxel_min_vertex)/(voxel_max_vertex-voxel_min_vertex) # B x 3

Please help!

@yashbhalgat
Copy link
Owner

Hi, please check if the shape of your input x is indeed (B, 3) (in your case, maybe (1, 3)?) or is it just (3, )?

@jayrmh

This comment was marked as resolved.

@jayrmh

This comment was marked as resolved.

@jayrmh
Copy link
Author

jayrmh commented Dec 3, 2022

Hey! I think I got it, my mistake, I somehow did not copy the Box-Offsets. Although, I wish to ask about the following lines: what are 0 and 1 indicating?

BOX_OFFSETS = torch.tensor([[[i,j,k] for i in [0, 1] for j in [0, 1] for k in [0, 1]]], device='cuda')

Secondly, the default minimum and maximum bounds are [100,100,100] and [-100,-100,-100]. How can I decide this number? For instance, I have a volume that is 160 x 160 x 160, with no ray tracing or density components. Therefore, would my bounds be [0,0,0] and [-160,-160,-160]?

Correct if I am wrong, but the Total Variation Loss, is for counting for each embedding hash layer right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants