Fix: error on instance from batch_x missing from batch_y in nearest() #168
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed the error described in issue #163
I implemented the lenient approach from my reply there (error only on if some batch instance is present in batch_x, but missing from batch_y). I implemented this as-is for the CPU version, and an equivalent check on the
ptr_x
/ptr_y
for the GPU version to catch the case where one ofbatch_x
/batch_y
isNone
.I also checked if any of the other methods suffer from the same problem, but that's not the case. Only
knn
andradius
takebatch_x
,batch_y
arguments, and both seem to correctly handle empty instances (don't return any edge within an empty instance).Additionally I implemented a check in
nearest()
if thebatch_x
,batch_y
are sorted (as it's a general requirement of the method, and I also rely on it when callingtorch.unique_consecutive()
).