FAILURE MAP
← Case archive

FA-100516 / Sparse tensor canonicalization / Open access

Sparse tensor: dense materialization overwrites duplicate coordinates · case 01

dense materialization overwrites duplicate coordinates.

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

ROOT CAUSE

Duplicate sparse coordinates represent additive contributions to one dense cell.

THE FAILURE

Duplicate sparse coordinates represent additive contributions to one dense cell.

Unsuccessful approach: Truthiness prevents overwrites but drops additional values whenever a cell is already nonzero.

Case contract

Create a rows-by-cols integer matrix initialized to zero and add every COO contribution at its coordinate.

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,rows,cols):
    out=[[0]*cols for _ in range(rows)]
    for r,c,v in entries: out[r][c]=v
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicate cell',solve([[0,1,N],[0,1,2]],2,2),[[0,N+2],[0,0]])
check('empty shape',solve([],N,1),[[0]]*N)
check('zero dimensions',solve([],0,N),[])
check('single cell',solve([[0,0,7]],1,1),[[7]])
check('cancel to zero',solve([[0,0,N],[0,0,-N]],1,1),[[0]])
check('separate cells',solve([[1,0,3],[0,1,4]],2,2),[[0,4],[3,0]])
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
duplicate cell[[0, 2], [0, 0]][[0, 3], [0, 0]]Failed
empty shape[[0]][[0]]Passed
zero dimensions[][]Passed
single cell[[7]][[7]]Passed
cancel to zero[[-1]][[0]]Failed
separate cells[[0, 4], [3, 0]][[0, 4], [3, 0]]Passed

SHA-256 / 822cdc5fe687808ba3f8f11a3688c975c22bca15bacdc4f36a3b4440ec87b99e

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(entries,rows,cols):
    out=[[0]*cols for _ in range(rows)]
    for r,c,v in entries: out[r][c]=out[r][c] or v
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicate cell',solve([[0,1,N],[0,1,2]],2,2),[[0,N+2],[0,0]])
check('empty shape',solve([],N,1),[[0]]*N)
check('zero dimensions',solve([],0,N),[])
check('single cell',solve([[0,0,7]],1,1),[[7]])
check('cancel to zero',solve([[0,0,N],[0,0,-N]],1,1),[[0]])
check('separate cells',solve([[1,0,3],[0,1,4]],2,2),[[0,4],[3,0]])
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
duplicate cell[[0, 1], [0, 0]][[0, 3], [0, 0]]Failed
empty shape[[0]][[0]]Passed
zero dimensions[][]Passed
single cell[[7]][[7]]Passed
cancel to zero[[1]][[0]]Failed
separate cells[[0, 4], [3, 0]][[0, 4], [3, 0]]Passed

SHA-256 / 893a1c2b6fc3b71a42e439b72949814786d1bc3ec38e845acef5449e0950c66f

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

Case digest / 46cf77ab046006167373a3ddc259ad626ad888e4094ea24c8f4db7a1ab97cf3f