Test upsample testsuite against multiple eltypes#716
Open
CarloLucibello wants to merge 1 commit into
Open
Conversation
Address the `T = Float32 # TODO test against all supported eltypes` item from #702. The forward/gradient testsets are now run in a loop over `[Float16, Float32, Float64]` (Metal drops `Float64`), mirroring the per-backend eltype pattern in `scatter.jl`. - Float16/Float64 forward + eltype-preservation are now covered (previously only Float32). `isapprox` relaxes `rtol` to the less-precise operand, so the ground-truth comparisons pass for Float16 unchanged. - Gradients are only checked at Float32/Float64: finite differences are unreliable at half precision, and the gradient kernels rely on atomics not universally available for Float16 on GPU. For Float16 the gradient comparison is skipped (`gradtest` skip / `gputest` checkgrad=false) and the explicit ∇ kernel checks are gated off. - The Rational/UInt8 forward tests move into their own testset so they run once rather than once per float eltype. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Addresses the
T = Float32 # TODO test against all supported eltypes for each backenditem catalogued in #702.The forward/gradient testsets in
test/testsuite/upsample.jl(upsample_nearest, linear/bilinear/trilinear) are now run in a loop over the float eltypes each backend supports:This mirrors the per-backend eltype pattern already used in
test/testsuite/scatter.jl. Metal dropsFloat64since it has none natively.Details
Float16/Float64forward + eltype-preservation are now covered (previously onlyFloat32).isapproxautomatically relaxesrtolto the less-precise operand, so the existing≈ground-truth comparisons pass forFloat16unchanged.Float32/Float64. Finite-difference gradient checking is unreliable at half precision (observed 3–17% error), so forFloat16only the forward pass runs — viagradtest'sskip=true(CPU) /gputest'scheckgrad=false(GPU).∇upsample_bilinear/∇upsample_trilinearcorrectness checks invoke the gradient kernels, which use@atomicadds (half-precision atomics aren't universally available on GPU), so they're gated behind the same condition.Float16stays forward-only — no atomics — on every backend.Rational/UInt8forward tests moved out of the per-eltype loop into their own testset so they run once instead of once per float eltype.pixel_shuffleand the complex-valued tests are unchanged.Testing
CPU testsuite is green: 129 pass, 5 intentional
Float16gradient skips, 0 failures. GPU backends were not run locally.🤖 Generated with Claude Code