-
Notifications
You must be signed in to change notification settings - Fork 375
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 do Sparse Tensor Indexing with Coordinates Tensor? #137
Comments
Currently, there is no function that exactly does that, but you can make one with
a_key = a_S.coords_key
b_key = a_S.coords_man.create_coords_key(b_C.int()) # it has to be int
a_indices, b_indices = a_S.coords_man.get_coords_map(a_key, b_key) If there is no match, the lists will be empty. But if you have matches, the order should be b_F = torch.zeros(len(b_C), a_F.shape[1]) # placeholder
if len(b_indices) > 0:
b_F[b_indices, :] = a_F[a_indices, :] I'll put this into a function in the next cycle. |
Thanks very much for the quick reply! I'll close this issue since it perfectly solved my issue. |
Hi I just made a function "features_at_coords(query_coords: IntTensor)". Could you see if it works? |
Hi I recently have some tried to do Spatial Propagation on sparse tensor and am wondering if you have implemented the sparse tensor indexing function somewhere so that I can directly use.
Here's a simple example case:
I want to select the feature according to the coordinates of a given tensor, and those coordinates doesn't have values, it can be set as
nan
or a customized value.If you know how to do this, I'm willing to implement the function and start a pull request.
The text was updated successfully, but these errors were encountered: