FAILURE MAP
← Case archive

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

Tensor views: flatten view combines adjacent strides · case 01

flatten view combines adjacent strides.

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

ROOT CAUSE

The flattened dimension keeps the first stride even when later axes determine its address step.

THE FAILURE

The flattened dimension keeps the first stride even when later axes determine its address step.

Unsuccessful approach: Using the last stride handles ordinary flattening but ignores whether the merged axes can be coalesced.

Case contract

Flatten axes [start,end] into one dimension; merged stride is stride[end], and other strides persist.

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, start, end):
    out=list(shape[:start])+[__import__('math').prod(shape[start:end+1])]+list(shape[end+1:])
    return out,list(strides[:start])+[strides[start]]+list(strides[end+1:])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contiguous middle',solve([2,N,3],[N*3,3,1],1,2),([2,3*N],[N*3,1]))
check('single axis',solve([2,N],[N,1],1,1),([2,N],[N,1]))
check('all axes',solve([2,3,4],[12,4,1],0,2),([24],[1]))
check('outer pair',solve([2,3,4],[12,4,1],0,1),([6,4],[4,1]))
check('noncontiguous',solve([2,3,4],[12,1,3],1,2),([2,12],[12,3]))
check('singleton stride',solve([2,1,3],[3,99,1],1,2),([2,3],[3,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
contiguous middle[[2, 3], [3, 3]][[2, 3], [3, 1]]Failed
single axis[[2, 1], [1, 1]][[2, 1], [1, 1]]Passed
all axes[[24], [12]][[24], [1]]Failed
outer pair[[6, 4], [12, 1]][[6, 4], [4, 1]]Failed
noncontiguous[[2, 12], [12, 1]][[2, 12], [12, 3]]Failed
singleton stride[[2, 3], [3, 99]][[2, 3], [3, 1]]Failed

SHA-256 / 517ffc6199942938303dce0d2af970bd532924c3d7a437d0d771adbe13c08321

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(shape, strides, start, end):
    out=list(shape[:start])+[__import__("math").prod(shape[start:end+1])]+list(shape[end+1:])
    s=list(strides[:start])+[strides[start]]+list(strides[end+1:])
    return out,s
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contiguous middle',solve([2,N,3],[N*3,3,1],1,2),([2,3*N],[N*3,1]))
check('single axis',solve([2,N],[N,1],1,1),([2,N],[N,1]))
check('all axes',solve([2,3,4],[12,4,1],0,2),([24],[1]))
check('outer pair',solve([2,3,4],[12,4,1],0,1),([6,4],[4,1]))
check('noncontiguous',solve([2,3,4],[12,1,3],1,2),([2,12],[12,3]))
check('singleton stride',solve([2,1,3],[3,99,1],1,2),([2,3],[3,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
contiguous middle[[2, 3], [3, 3]][[2, 3], [3, 1]]Failed
single axis[[2, 1], [1, 1]][[2, 1], [1, 1]]Passed
all axes[[24], [12]][[24], [1]]Failed
outer pair[[6, 4], [12, 1]][[6, 4], [4, 1]]Failed
noncontiguous[[2, 12], [12, 1]][[2, 12], [12, 3]]Failed
singleton stride[[2, 3], [3, 99]][[2, 3], [3, 1]]Failed

SHA-256 / 8b76aaaae4cac5260cf1a5b4a6321faf1744f6754b9c74354d2ff7aef472fe21

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.724714+00:00.

Case digest / e7d7f1fdabe954df5960cc0446aab493ae91e9634f30cb25e003d30f85bf3593