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

Fix resize methods with kernel #554

Merged
merged 2 commits into from
Feb 16, 2024
Merged

Fix resize methods with kernel #554

merged 2 commits into from
Feb 16, 2024

Conversation

jonatanklosko
Copy link
Member

Currently the resize methods other than nearest give wrong results.

@@ -2049,7 +2049,9 @@ defmodule Axon.Layers do
kernel_scale = Nx.max(1, inv_scale)

sample_f =
Nx.add(Nx.iota({1, output_size}), 0.5) |> Nx.multiply(Nx.subtract(inv_scale, 0.5))
Nx.add(Nx.iota({1, output_size}), 0.5)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love PEMDAS

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, I've just pushed a version we use in NxImage with more stuff in defn for clarity :)

@jonatanklosko jonatanklosko merged commit cfa77a3 into main Feb 16, 2024
3 of 5 checks passed
@jonatanklosko jonatanklosko deleted the jk-resize branch February 16, 2024 17:20
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

Successfully merging this pull request may close these issues.

None yet

2 participants