Fix window_scatter_max/min crash on f64 tensors#1711
Open
blasphemetheus wants to merge 1 commit intoelixir-nx:mainfrom
Open
Fix window_scatter_max/min crash on f64 tensors#1711blasphemetheus wants to merge 1 commit intoelixir-nx:mainfrom
blasphemetheus wants to merge 1 commit intoelixir-nx:mainfrom
Conversation
The scatter result was not cast to the output type before to_binary, causing a binary size mismatch for f64 (8-byte) tensors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
b6956c0 to
3cba2e1
Compare
polvalente
reviewed
Mar 20, 2026
Comment on lines
+7433
to
+7442
|
|
||
| It also works with f64 tensors: | ||
|
|
||
| iex> t = Nx.iota({6}, type: :f64) | ||
| iex> s = Nx.iota({3}, type: :f64) | ||
| iex> Nx.window_scatter_max(t, s, 0.0, {2}, strides: [2], padding: :valid) | ||
| #Nx.Tensor< | ||
| f64[6] | ||
| [0.0, 0.0, 0.0, 1.0, 0.0, 2.0] | ||
| > |
Contributor
There was a problem hiding this comment.
This should be a regular test if we're only fixing a binary backend bug
Contributor
There was a problem hiding this comment.
Just saw we have the tests, so let's remove this one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
window_scatter_maxandwindow_scatter_mincrash with f64 tensors.This does not affect f32. The scatter result in
select_and_scatterwasn't cast to the output type before to_binary, causing a binary size mismatch for f64 (8-byte) tensors.So the fix is:
value |> Nx.as_type(output_type) |> to_binary()running window_scatter_f64_test.exs on main
originally part of the closed fuzz test edge case PR #1707