FAILURE MAP
← Case archive

FA-100461 / Sparse tensor canonicalization / Open access

Sparse tensor: CSR expansion loses rows with repeated row pointers · case 01

CSR expansion loses rows with repeated row pointers.

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

ROOT CAUSE

Rows are inferred from pointer intervals; repeated offsets encode valid empty rows.

THE FAILURE

Rows are inferred from pointer intervals; repeated offsets encode valid empty rows.

Unsuccessful approach: Strictly-before counting maps an offset exactly at a row boundary to the preceding row, so the attempted mapping still mislabels the first value in a row.

Case contract

Expand valid CSR arrays into [row,column,value] entries, including correct row identity after 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(ptr,columns,values):
    return [[min(i for i in range(len(ptr)-1) if ptr[i]<=k),columns[k],values[k]] for k in range(len(values))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty middle',solve([0,1,1,2],[2,0],[5,7]),[[0,2,5],[2,0,7]])
check('leading empty',solve([0,0,1],[N],[8]),[[1,N,8]])
check('all empty',solve([0,0,0],[],[]),[])
check('single row',solve([0,1],[3],[N]),[[0,3,N]])
check('two per row',solve([0,2,4],[0,1,2,3],[1,2,3,4]),[[0,0,1],[0,1,2],[1,2,3],[1,3,4]])
check('trailing empty',solve([0,1,1,1],[N],[6]),[[0,N,6]])
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
empty middle[[0, 2, 5], [0, 0, 7]][[0, 2, 5], [2, 0, 7]]Failed
leading empty[[0, 1, 8]][[1, 1, 8]]Failed
all empty[][]Passed
single row[[0, 3, 1]][[0, 3, 1]]Passed
two per row[[0, 0, 1], [0, 1, 2], [0, 2, 3], [0, 3, 4]][[0, 0, 1], [0, 1, 2], [1, 2, 3], [1, 3, 4]]Failed
trailing empty[[0, 1, 6]][[0, 1, 6]]Passed

SHA-256 / 16460bbf91c7db1a43d9f79298a6a29b34eaf45f9bdf0347cd341439a078cba0

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(ptr,columns,values):
    return [[sum(ptr[i+1]<k for i in range(len(ptr)-1)),columns[k],values[k]] for k in range(len(values))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty middle',solve([0,1,1,2],[2,0],[5,7]),[[0,2,5],[2,0,7]])
check('leading empty',solve([0,0,1],[N],[8]),[[1,N,8]])
check('all empty',solve([0,0,0],[],[]),[])
check('single row',solve([0,1],[3],[N]),[[0,3,N]])
check('two per row',solve([0,2,4],[0,1,2,3],[1,2,3,4]),[[0,0,1],[0,1,2],[1,2,3],[1,3,4]])
check('trailing empty',solve([0,1,1,1],[N],[6]),[[0,N,6]])
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
empty middle[[0, 2, 5], [0, 0, 7]][[0, 2, 5], [2, 0, 7]]Failed
leading empty[[0, 1, 8]][[1, 1, 8]]Failed
all empty[][]Passed
single row[[0, 3, 1]][[0, 3, 1]]Passed
two per row[[0, 0, 1], [0, 1, 2], [0, 2, 3], [1, 3, 4]][[0, 0, 1], [0, 1, 2], [1, 2, 3], [1, 3, 4]]Failed
trailing empty[[0, 1, 6]][[0, 1, 6]]Passed

SHA-256 / e0b67f66676d016aa8d28003a5ab4ec007b313cfa3216de92831b58025a63ba9

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

Case digest / 8511d0f6a9dbe15739059246a2ec6301cdcdb23699e1cef7fd177de6d3dc8bf8