FAILURE MAP
← Case archive

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

Tensor views: broadcast strides align with leading singleton axes · case 01

broadcast strides align with leading singleton axes.

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

ROOT CAUSE

When target rank grows, source axes must align to the right after adding leading singleton axes.

THE FAILURE

When target rank grows, source axes must align to the right after adding leading singleton axes.

Unsuccessful approach: Zeroing expanded strides without first aligning ranks pairs the wrong source and target axes.

Case contract

Align source strides to target rank by adding leading zero strides; expanded singleton dimensions use stride zero.

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, target):
    return list(strides)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('prepend batch',solve([N,3],[3,1],[2,N,3]),[0,3,1])
check('expand leading singleton',solve([1,3],[3,1],[4,3]),[0,1])
check('expand trailing',solve([2,1],[1,1],[2,4]),[1,0])
check('unchanged',solve([2,3],[3,1],[2,3]),[3,1])
check('rank one source',solve([N],[2],[4,N]),[0,2])
check('multiple new axes',solve([1],[7],[2,3,1]),[0,0,7])
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
prepend batch[3, 1][0, 3, 1]Failed
expand leading singleton[3, 1][0, 1]Failed
expand trailing[1, 1][1, 0]Failed
unchanged[3, 1][3, 1]Passed
rank one source[2][0, 2]Failed
multiple new axes[7][0, 0, 7]Failed

SHA-256 / f35062e5b35fbfc45c272d97436f9064ca8916dd8cf579fd567d009f3a075dff

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(shape, strides, target):
    return [s if d==t else 0 for d,s,t in zip(shape,strides,target)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('prepend batch',solve([N,3],[3,1],[2,N,3]),[0,3,1])
check('expand leading singleton',solve([1,3],[3,1],[4,3]),[0,1])
check('expand trailing',solve([2,1],[1,1],[2,4]),[1,0])
check('unchanged',solve([2,3],[3,1],[2,3]),[3,1])
check('rank one source',solve([N],[2],[4,N]),[0,2])
check('multiple new axes',solve([1],[7],[2,3,1]),[0,0,7])
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
prepend batch[0, 0][0, 3, 1]Failed
expand leading singleton[0, 1][0, 1]Passed
expand trailing[1, 0][1, 0]Passed
unchanged[3, 1][3, 1]Passed
rank one source[0][0, 2]Failed
multiple new axes[0][0, 0, 7]Failed

SHA-256 / 4d5139709d8905fb383bb8a2d30fcf985d5aa7af363fa22e80740bf9eb0c419d

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

Case digest / 68096e97a9a5170be8298b43a45bc5a42dd811e5d4362470f565002422e0af1e