Refactor interpolation functionals and add point-to-grid API#1542
Refactor interpolation functionals and add point-to-grid API#1542ktangsali merged 13 commits intoNVIDIA:mainfrom
Conversation
Greptile SummaryThis PR refactors the existing Key concerns:
Important Files Changed
|
| def point_to_grid_interpolation_warp( | ||
| query_points: torch.Tensor, | ||
| point_values: torch.Tensor, | ||
| grid: List[Tuple[float, float, int]], | ||
| interpolation_type: str = "smooth_step_2", | ||
| mem_speed_trade: bool = True, | ||
| ) -> torch.Tensor: | ||
| if query_points.dtype != torch.float32: |
There was a problem hiding this comment.
Inconsistent dtype enforcement between g2p and p2g backends
point_to_grid_interpolation_warp raises TypeError for any non-float32 input, while the grid_to_point_interpolation warp backend (interpolation_warp / interpolation_impl) silently converts any dtype to float32 and casts the output back. This asymmetry means that a workflow using float16 or float64 tensors can call grid_to_point_interpolation without error, but will crash when calling point_to_grid_interpolation with the same inputs, even though the underlying point_to_grid_interpolation_impl custom-op already handles non-float32 via the same cast-and-convert pattern.
Similarly, the torch backend for p2g (in _normalize_inputs) raises TypeError for non-float32, whereas the torch backend for g2p (interpolation_torch) applies no dtype check at all.
Consider aligning the two warp backends to the same policy — either both silently cast (as g2p does) or both require float32 explicitly (as p2g does) — so the two functionals are interchangeable in typical adjoint workflows.
| .. rubric:: Benchmarks (ASV) | ||
|
|
||
| .. figure:: /img/nn/functional/radius_search/benchmark.png | ||
| .. figure:: ../../../img/nn/functional/radius_search/benchmark.png |
There was a problem hiding this comment.
This is unrelated but fixes a doc bug.
Signed-off-by: Mehdi Ataei <ataei8@gmail.com>
|
Hey @loliverhennigh. I opened a PR with the changes we discussed here: loliverhennigh#1 |
|
/blossom-ci |
|
/blossom-ci |
|
/blossom-ci |
|
/blossom-ci |
1 similar comment
|
/blossom-ci |
|
Discussed with @loliverhennigh offline. Seems like @mehdiataei has reviewed and approved but for some reason the approval is not showing up here. Merging this to unblock. |
PhysicsNeMo Pull Request
Description
Just flushing out the interpolation functionals a bit. Adding better names and expanding to point to grid interpolation.
Still trying to figure out how to get AI to open PRs for me ok so apologies for the like 4 closed PRs on this.