FAILURE MAP
← Case archive

FA-100456 / Sparse tensor canonicalization / Open access

Sparse tensor: CSR row pointers omit empty rows · case 01

CSR row pointers omit empty rows.

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

ROOT CAUSE

Empty rows do not advance the stored-value offset, but the row boundary still needs its own pointer.

THE FAILURE

Empty rows do not advance the stored-value offset, but the row boundary still needs its own pointer.

Unsuccessful approach: The attempt retains empty-row boundaries but invents a stored element for every empty row.

Case contract

Build CSR row pointers for a matrix with given row count and sorted unique COO entries; repeated pointer values represent empty rows.

Why this case matters

A small offline sparse-array operation has explicit coordinate and storage semantics.

1 / The failure

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

N = 1
observations = []
def solve(rows,entries):
    counts=[0]*rows
    for r,c,v in entries: counts[r]+=1
    ptr=[0]
    for n in counts:
     if n: ptr.append(ptr[-1]+n)
    return ptr
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('middle empty',solve(N+2,[[0,0,1],[N+1,1,2]]),[0,1]+[1]*N+[2])
check('all empty',solve(N,[]),[0]*(N+1))
check('one row',solve(1,[[0,0,7]]),[0,1])
check('every row',solve(3,[[0,0,1],[1,1,2],[2,2,3]]),[0,1,2,3])
check('two in row',solve(2,[[0,0,1],[0,1,2],[1,0,4]]),[0,2,3])
check('leading empty',solve(3,[[1,1,4]]),[0,0,1,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
middle empty[0, 1, 2][0, 1, 1, 2]Failed
all empty[0][0, 0]Failed
one row[0, 1][0, 1]Passed
every row[0, 1, 2, 3][0, 1, 2, 3]Passed
two in row[0, 2, 3][0, 2, 3]Passed
leading empty[0, 1][0, 0, 1, 1]Failed

SHA-256 / a2669d5eb2edf8a7b7751c73e01704196c12b77ef1aff5e1449ca248fa675ac3

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(rows,entries):
    counts=[0]*rows
    for r,c,v in entries: counts[r]+=1
    ptr=[0]
    for n in counts: ptr.append(ptr[-1]+max(1,n))
    return ptr
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('middle empty',solve(N+2,[[0,0,1],[N+1,1,2]]),[0,1]+[1]*N+[2])
check('all empty',solve(N,[]),[0]*(N+1))
check('one row',solve(1,[[0,0,7]]),[0,1])
check('every row',solve(3,[[0,0,1],[1,1,2],[2,2,3]]),[0,1,2,3])
check('two in row',solve(2,[[0,0,1],[0,1,2],[1,0,4]]),[0,2,3])
check('leading empty',solve(3,[[1,1,4]]),[0,0,1,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
middle empty[0, 1, 2, 3][0, 1, 1, 2]Failed
all empty[0, 1][0, 0]Failed
one row[0, 1][0, 1]Passed
every row[0, 1, 2, 3][0, 1, 2, 3]Passed
two in row[0, 2, 3][0, 2, 3]Passed
leading empty[0, 1, 2, 3][0, 0, 1, 1]Failed

SHA-256 / e62364851a3391c40d29a7313b1da3ff980a455a5a82e9741a6fa784bee7dbc2

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

These are toy integer-valued COO or CSR contracts; they make no claim about a framework API, floating point policy, or large tensor performance. 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:35.815072+00:00.

Case digest / 33cc4b05922a0434e94095d5967e2d4479d4ad56cdb58eacf344efa925c1d088