FAILURE MAP
← Case archive

FA-98796 / Tensor stride and reshape semantics / Open access

Tensor views: squeeze removes only unit dimensions · case 01

squeeze removes only unit dimensions.

Verified by executionVariant 1 · 6 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Removing unit dimensions from shape without removing the corresponding stride entries breaks rank alignment.

THE FAILURE

Removing unit dimensions from shape without removing the corresponding stride entries breaks rank alignment.

Unsuccessful approach: Removing only boundary unit axes leaves interior unit dimensions behind.

Case contract

Remove all dimensions of size one and their corresponding strides.

Why this case matters

Dense tensor views rely on consistent logical coordinates and physical storage addresses.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(shape, strides):
    return [d for d in shape if d!=1],list(strides)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('interleaved units',solve([1,N+1,1,3],[99,3,88,1]),([N+1,3],[3,1]))
check('no units',solve([2,3],[3,1]),([2,3],[3,1]))
check('all units',solve([1,1],[8,2]),([],[]))
check('rank zero',solve([],[]),([],[]))
check('leading unit',solve([1,4],[4,1]),([4],[1]))
check('trailing unit',solve([2,1],[1,1]),([2],[1]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
interleaved units[[2, 3], [99, 3, 88, 1]][[2, 3], [3, 1]]Failed
no units[[2, 3], [3, 1]][[2, 3], [3, 1]]Passed
all units[[], [8, 2]][[], []]Failed
rank zero[[], []][[], []]Passed
leading unit[[4], [4, 1]][[4], [1]]Failed
trailing unit[[2], [1, 1]][[2], [1]]Failed

SHA-256 / 8d18fb42c9a2624348c2998379cc81971dc107288ebc9dfdeef3a0762571d9f7

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(shape, strides):
    lo=0; hi=len(shape)
    if lo<hi and shape[lo]==1: lo+=1
    if lo<hi and shape[hi-1]==1: hi-=1
    return list(shape[lo:hi]),list(strides[lo:hi])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('interleaved units',solve([1,N+1,1,3],[99,3,88,1]),([N+1,3],[3,1]))
check('no units',solve([2,3],[3,1]),([2,3],[3,1]))
check('all units',solve([1,1],[8,2]),([],[]))
check('rank zero',solve([],[]),([],[]))
check('leading unit',solve([1,4],[4,1]),([4],[1]))
check('trailing unit',solve([2,1],[1,1]),([2],[1]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
interleaved units[[2, 1, 3], [3, 88, 1]][[2, 3], [3, 1]]Failed
no units[[2, 3], [3, 1]][[2, 3], [3, 1]]Passed
all units[[], []][[], []]Passed
rank zero[[], []][[], []]Passed
leading unit[[4], [1]][[4], [1]]Passed
trailing unit[[2], [1]][[2], [1]]Passed

SHA-256 / 6de6140918c3e92cb3a871f6f8a1621f06cf20b08e092a1ad1784e42e61fe279

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 6 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

Self-contained integer metadata models only; no production framework compatibility or performance claim. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-30T16:48:16.725051+00:00.

Case digest / 727525514e5e08649fdd015b24e73ba47efdb233c90534971a7515a357e64f3f