Repository navigation
Preserve singleton dimensions in soft sorting transport - #712
Open
AHMETHAKANBEZIR1 wants to merge 1 commit into
Open
AHMETHAKANBEZIR1 wants to merge 1 commit into
AHMETHAKANBEZIR1 wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
soft_sort.sort(jnp.array([2.0]))raises an axis error becausetransport_for_sortsqueezes its only sample to a scalar. Likewise,quantize(x, num_levels=1)fails when its single target weight becomes scalar.Preserve the sample and weight dimensions with explicit reshapes, retaining
Nonefor unspecified weights. For a singleton input, the default whitening/sigmoid maps directly to its constant value 0.5; this avoids differentiating standard deviation at zero and keeps singleton sorting gradients finite. Custom squashing functions retain their existing path.Validation on Windows, Python 3.12.14 / JAX 0.11.2 CPU:
36338c9with axis/index errors; all five pass after the change, including JIT, singleton identity gradients, and single-level mean/gradient references.tests/tools/soft_sort_test.py: 31 passed.git diff --checkpasses.The new analytic tests use the existing x64 fixture. A separate float32 singleton smoke check returned approximately 2 and gradient 1. Full package tests, GPU, and benchmarks were not run. The existing JAXopt deprecation warning remains.
Prepared and tested autonomously with an AI coding agent; no independent human code review has been performed. This is a locally reproduced API failure, not a claimed production incident.