FAILURE MAP
← Case archive

FA-100446 / Sparse tensor canonicalization / Open access

Sparse tensor: COO entries retain input order instead of row-major canonical order · case 01

COO entries retain input order instead of row-major canonical order.

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

ROOT CAUSE

Input encounter order is mistaken for canonical coordinate order.

THE FAILURE

Input encounter order is mistaken for canonical coordinate order.

Unsuccessful approach: Sorting by row alone leaves columns in arbitrary encounter order.

Case contract

Return entries sorted by row then column; coordinates are unique and values are preserved.

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(entries):
    return entries
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reverse coordinates',solve([[1,0,N],[0,2,4]]),[[0,2,4],[1,0,N]])
check('column order',solve([[0,2,1],[0,1,2],[0,0,3]]),[[0,0,3],[0,1,2],[0,2,1]])
check('empty',solve([]),[])
check('singleton',solve([[N,1,7]]),[[N,1,7]])
check('row tie',solve([[2,3,1],[2,1,5],[2,2,4]]),[[2,1,5],[2,2,4],[2,3,1]])
check('already ordered',solve([[0,0,1],[1,0,2]]),[[0,0,1],[1,0,2]])
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
reverse coordinates[[1, 0, 1], [0, 2, 4]][[0, 2, 4], [1, 0, 1]]Failed
column order[[0, 2, 1], [0, 1, 2], [0, 0, 3]][[0, 0, 3], [0, 1, 2], [0, 2, 1]]Failed
empty[][]Passed
singleton[[1, 1, 7]][[1, 1, 7]]Passed
row tie[[2, 3, 1], [2, 1, 5], [2, 2, 4]][[2, 1, 5], [2, 2, 4], [2, 3, 1]]Failed
already ordered[[0, 0, 1], [1, 0, 2]][[0, 0, 1], [1, 0, 2]]Passed

SHA-256 / ca89da1d4bbba138bbb947fded54d18db77c353b80df5b48011a1ac1eae1b3ed

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(entries):
    return sorted(entries,key=lambda e:e[0])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reverse coordinates',solve([[1,0,N],[0,2,4]]),[[0,2,4],[1,0,N]])
check('column order',solve([[0,2,1],[0,1,2],[0,0,3]]),[[0,0,3],[0,1,2],[0,2,1]])
check('empty',solve([]),[])
check('singleton',solve([[N,1,7]]),[[N,1,7]])
check('row tie',solve([[2,3,1],[2,1,5],[2,2,4]]),[[2,1,5],[2,2,4],[2,3,1]])
check('already ordered',solve([[0,0,1],[1,0,2]]),[[0,0,1],[1,0,2]])
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
reverse coordinates[[0, 2, 4], [1, 0, 1]][[0, 2, 4], [1, 0, 1]]Passed
column order[[0, 2, 1], [0, 1, 2], [0, 0, 3]][[0, 0, 3], [0, 1, 2], [0, 2, 1]]Failed
empty[][]Passed
singleton[[1, 1, 7]][[1, 1, 7]]Passed
row tie[[2, 3, 1], [2, 1, 5], [2, 2, 4]][[2, 1, 5], [2, 2, 4], [2, 3, 1]]Failed
already ordered[[0, 0, 1], [1, 0, 2]][[0, 0, 1], [1, 0, 2]]Passed

SHA-256 / 1d4de47caf12f908d8d40e205aa0e9b43d208a415f2d28af0f76fba60785f309

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

Case digest / 676dfa1113b5562aafef081a7be5b641b191c171673fa67d29462b88393b0040