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

Feature Request, getting indices from a LazyTensor #341

Open
yaadhavraajagility opened this issue Oct 17, 2023 · 1 comment
Open

Feature Request, getting indices from a LazyTensor #341

yaadhavraajagility opened this issue Oct 17, 2023 · 1 comment

Comments

@yaadhavraajagility
Copy link

yaadhavraajagility commented Oct 17, 2023

I have a specific use case where i have a [B, N, M] tensor that stores distance values.
I would like to do an operation akin to sample_from_tensor[squared_distance_lazy_tensor > radius]

But it looks like TypeError: '>' not supported between instances of 'LazyTensor' and 'LazyTensor'

Alternatively, it looks like you support Kmin_argKmin. Instead of the k nearest neighbour approach, do you have something that can return indices say based on distance?

@joanglaunes
Copy link
Contributor

Hello @yaadhavraajagility ,
About your first question, comparison operators have been added recently into KeOps, so it is available when using the main git branch, but not yet in the released version of KeOps.
Now about your second question, it is not clear what you would like to get exactly. If it is for example to get all indices of points whose distance from the current point is below some threshold, then the problem is that this is has quadratic memory footprint in general, similar to the distance matrix itself, and KeOps currently does not return O(MN) arrays since its purpose is to avoid them. Then if the purpose is to sample from these selected points as in your first question, then using the > comparison operation will give a binary mask (as a LazyTensor), and then you can perform a reduction operation which will correspond to the sampling, so there should be no need for indices.
So could you tell us what would be your use case for returning indices ?

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