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 to get the coords index of previous coords after convolution with stride more than one #70

Closed
wbhu opened this issue Dec 28, 2019 · 4 comments

Comments

@wbhu
Copy link

wbhu commented Dec 28, 2019

Hi,

If we apply a stride 2 convolution on a sparse tensor x to get a new sparse tenseor y, than the number of coords of y should be less than x, how can we get the current index of coords of x, such that x.coords[index] == y.coords?

Thanks a lot!

@chrischoy
Copy link
Contributor

When generating the strided map, I use floor to make all the generated coords divisible by the stride. In this case, there are many coords that are not equal to the strided coords. What behavior are you looking for? Do you want exact coords only? Or do you want all coords that map to the strided coords using floor?

@wbhu
Copy link
Author

wbhu commented Dec 29, 2019

Thanks for your quick reply. I want all coords that map to the strided coords using floor. In detail, I have some feature that is associate with the coords, but this feature can not be convolved, so after strided covolution I want to extract the new feature cooresponding to the the new coords. If i can get the index, then this problem can be solved.

@chrischoy
Copy link
Contributor

I added the function get_coords_map(in_tensor_stride, out_tensor_stride).

Usage:

sinput = SparseTensor(...)
soutput = stride_2_conv(sinput)

cm = sinput.coords_man # or soutput.coords_man. Doesn't matter.
ins, outs = cm.get_coords_map(1, 2)
inc = cm.get_coords(1)
outc = cm.get_coords(2)
for i, o in zip(ins, outs):
    print(f"{i}: ({inc[i]}) -> {o}: ({outc[o]})")

@wbhu
Copy link
Author

wbhu commented Jan 1, 2020

That's great. Thanks for your help.

Tanazzah pushed a commit to Tanazzah/MinkowskiEngine that referenced this issue Feb 9, 2024
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