FAILURE MAP
← Case archive

FA-100466 / Sparse tensor canonicalization / Open access

Sparse tensor: columns inside each CSR row are not canonicalized · case 01

columns inside each CSR row are not canonicalized.

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

ROOT CAUSE

CSR canonical form orders column indices within each row and values must follow their columns.

THE FAILURE

CSR canonical form orders column indices within each row and values must follow their columns.

Unsuccessful approach: The attempt computes row-local ordering but breaks the column/value association.

Case contract

Sort each CSR row by column while keeping each column paired with its original value.

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 [columns,values]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('paired sort',solve([0,2],[N,1],[50,20]),[[1,N],[20,50]])
check('two rows',solve([0,2,3],[2,0,1],[8,4,7]),[[0,2,1],[4,8,7]])
check('empty',solve([0],[],[]),[[],[]])
check('singleton row',solve([0,1],[N],[3]),[[N],[3]])
check('already sorted',solve([0,2],[0,1],[5,6]),[[0,1],[5,6]])
check('empty first row',solve([0,0,2],[3,1],[9,2]),[[1,3],[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
paired sort[[1, 1], [50, 20]][[1, 1], [20, 50]]Failed
two rows[[2, 0, 1], [8, 4, 7]][[0, 2, 1], [4, 8, 7]]Failed
empty[[], []][[], []]Passed
singleton row[[1], [3]][[1], [3]]Passed
already sorted[[0, 1], [5, 6]][[0, 1], [5, 6]]Passed
empty first row[[3, 1], [9, 2]][[1, 3], [2, 9]]Failed

SHA-256 / 007ad27bafadab2a7c41e8b6815e9a9095d3c2ac0d9290cb8c27c57beb13e79a

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(ptr,columns,values):
    outc=columns[:]; outv=values[:]
    for r in range(len(ptr)-1):
     pairs=sorted(zip(columns[ptr[r]:ptr[r+1]],values[ptr[r]:ptr[r+1]]))
     outc[ptr[r]:ptr[r+1]]=[p[0] for p in pairs]
    return [outc,outv]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('paired sort',solve([0,2],[N,1],[50,20]),[[1,N],[20,50]])
check('two rows',solve([0,2,3],[2,0,1],[8,4,7]),[[0,2,1],[4,8,7]])
check('empty',solve([0],[],[]),[[],[]])
check('singleton row',solve([0,1],[N],[3]),[[N],[3]])
check('already sorted',solve([0,2],[0,1],[5,6]),[[0,1],[5,6]])
check('empty first row',solve([0,0,2],[3,1],[9,2]),[[1,3],[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
paired sort[[1, 1], [50, 20]][[1, 1], [20, 50]]Failed
two rows[[0, 2, 1], [8, 4, 7]][[0, 2, 1], [4, 8, 7]]Failed
empty[[], []][[], []]Passed
singleton row[[1], [3]][[1], [3]]Passed
already sorted[[0, 1], [5, 6]][[0, 1], [5, 6]]Passed
empty first row[[1, 3], [9, 2]][[1, 3], [2, 9]]Failed

SHA-256 / 23b8a2c0b0df544a1abc2f83f123463b346aa6b966dfe073d0d03a60fa8aeaa8

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

Case digest / 676e873237880cf201c6275e219f2301f829f472aaf9d276b72d4abb7a2279c1