FAILURE MAP
← Case archive

FA-100536 / Sparse tensor canonicalization / Open access

Sparse tensor: CSR conversion assigns entries using value offsets as row numbers · case 01

CSR conversion assigns entries using value offsets as row numbers.

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

ROOT CAUSE

CSR row identities come from pointer intervals, while the value-array offset selects the stored element.

THE FAILURE

CSR row identities come from pointer intervals, while the value-array offset selects the stored element.

Unsuccessful approach: The end pointer is exclusive; iterating inclusively can steal the first element of the following row.

Case contract

Convert valid CSR storage to row-major COO [row,column,value] entries.

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 [[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 row',solve([0,1,1,3],[2,0,1],[5,6,7]),[[0,2,5],[2,0,6],[2,1,7]])
check('single row',solve([0,2],[N,1],[4,8]),[[0,N,4],[0,1,8]])
check('all empty',solve([0,0,0],[],[]),[])
check('three rows',solve([0,1,2,3],[0,1,2],[3,4,5]),[[0,0,3],[1,1,4],[2,2,5]])
check('leading empty',solve([0,0,1],[N],[7]),[[1,N,7]])
check('trailing empty',solve([0,1,1],[2],[9]),[[0,2,9]])
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 row[[0, 2, 5], [1, 0, 6], [2, 1, 7]][[0, 2, 5], [2, 0, 6], [2, 1, 7]]Failed
single row[[0, 1, 4], [1, 1, 8]][[0, 1, 4], [0, 1, 8]]Failed
all empty[][]Passed
three rows[[0, 0, 3], [1, 1, 4], [2, 2, 5]][[0, 0, 3], [1, 1, 4], [2, 2, 5]]Passed
leading empty[[0, 1, 7]][[1, 1, 7]]Failed
trailing empty[[0, 2, 9]][[0, 2, 9]]Passed

SHA-256 / d94cf374ca4199035712b7dbf46788430f5d63d841b44f736de1c5fca0151efc

2 / The unsuccessful fix

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

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

SHA-256 / 92b7df115bd6fca724d9eb8bcab2a00b7844ac0f3693f11701a7b935567917ae

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

Case digest / c05bfad0a2c6d368f1f6b7ed4536f8d1392f77342d6848909cdfd038812d3b11