Skip to content

learning: Patchwise repeats a single item's keywords for every patch - #165

Merged
mcencini merged 12 commits into
mainfrom
claude/project-thread-srpk8h
Nov 2, 2026
Merged

mcencini merged 12 commits into
mainfrom
claude/project-thread-srpk8h

Conversation

@mcencini

@mcencini mcencini commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Patchwise._run repeated per-item keywords (and sigma) across the patches of a call only when there was more than one item. With one volume and batch > 1, a class-conditioned network got a label of shape (1,) for batch patches, and MRI2Qmap's teacher UNet failed its shape assertion (unet.py:655). Now one item's values are repeated as well.

Test: a network that asserts one label and one sigma per patch, at batch 1 and 3. It fails before the fix and passes after.


Generated by Claude Code

claude added 12 commits November 1, 2026 21:21
positions with one index more than the phase encodes -- (y, x) in 2D,
(z, y, x) in 3D -- are single samples on the grid, as GROG-gridded
non-Cartesian samples are. A weight per position (e.g. sqrt of a density
compensation) multiplies the samples, its conjugate the adjoint, and enters
the normal squared; it works for whole readouts too.

For single samples the normal kernel is summed straight from the samples,
kept only at the places they reach, and applied between FFTs on the image
grid (one coset, no doubled grid) through the same cuFFT callbacks, coil
kernels and coil slabs as the Cartesian normal. Nothing the size of
frames x volume is built; off the card the normal applies the compressed
kernel between BART's transforms. Place coordinates become (z, y, x0) in
the gather/scatter kernels so lines and points share them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MFB6QNUxWSoR8RjtuWacSY
With an operator, data_scaling handed |A^H y| to BART's
estimate_scaling_norm, which copies it to the host and sorts the whole
array for three order statistics. At 256^3 x rank 4 that is 34 s of a
recon. The median, the 90th percentile, the maximum (or the asked-for
percentile) are now found with torch.kthvalue at BART's indices, on the
operator's card when it has one: the same rule and the same elements, to
the last bit of the magnitude.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MFB6QNUxWSoR8RjtuWacSY
…ies its probes on a device

A solve's start computes A^H y anyway, and on a card a volume's probe
crossing the bus twice cost a second of a 256^3 recon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MFB6QNUxWSoR8RjtuWacSY
…ce='cuda') sees cuda:0 as its card

A host-built operator given a card probe segfaulted in BART's normal, and a
solve placed on 'cuda' recursed since cuda:0 != cuda.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MFB6QNUxWSoR8RjtuWacSY
…; scaling sorts once on a card

CG(device='cuda') handed BART card vectors with a host operator and
segfaulted; it now says to build the encoding on the card, as the test does.
kthvalue over 67 M magnitudes took about a second on an A40; one radix sort
gives the same order statistics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MFB6QNUxWSoR8RjtuWacSY
…of a batch

A class-conditioned network (MRI2Qmap's teacher) given one label for one
volume failed its shape check at batch > 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MFB6QNUxWSoR8RjtuWacSY
@codecov

codecov Bot commented Nov 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mcencini
mcencini merged commit 90432fe into main Nov 2, 2026
18 checks passed
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.

2 participants