FAILURE MAP
← Case archive

FA-100511 / Sparse tensor canonicalization / Open access

Sparse tensor: stored entry count is reported instead of logical nonzero count · case 01

stored entry count is reported instead of logical nonzero count.

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

ROOT CAUSE

Physical COO records are not equivalent to distinct nonzero tensor coordinates.

THE FAILURE

Physical COO records are not equivalent to distinct nonzero tensor coordinates.

Unsuccessful approach: Input records that are individually nonzero may cancel after coalescing, so the count must use final coordinate totals.

Case contract

Coalesce duplicate coordinates, remove final zeros, and return the count of remaining logical coordinates.

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 len(entries)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicates coalesce',solve([[0,0,N],[0,0,2],[1,0,5]]),2)
check('cancellation',solve([[0,0,N],[0,0,-N]]),0)
check('empty',solve([]),0)
check('single zero',solve([[0,0,0]]),0)
check('unique',solve([[0,0,3],[1,1,4]]),2)
check('one surviving',solve([[0,0,0],[1,2,N]]),1)
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
duplicates coalesce32Failed
cancellation20Failed
empty00Passed
single zero10Failed
unique22Passed
one surviving21Failed

SHA-256 / 095c784c1b6bfbf7df46f1fb193eabe31ac42dc1f80c1439aae2094be4b3e74f

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(entries):
    coords={}
    for r,c,v in entries: coords[(r,c)]=coords.get((r,c),0)+v
    return sum(v!=0 for r,c,v in entries)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicates coalesce',solve([[0,0,N],[0,0,2],[1,0,5]]),2)
check('cancellation',solve([[0,0,N],[0,0,-N]]),0)
check('empty',solve([]),0)
check('single zero',solve([[0,0,0]]),0)
check('unique',solve([[0,0,3],[1,1,4]]),2)
check('one surviving',solve([[0,0,0],[1,2,N]]),1)
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
duplicates coalesce32Failed
cancellation20Failed
empty00Passed
single zero00Passed
unique22Passed
one surviving11Passed

SHA-256 / 6146e14cd4d88b240b18576322ee28df8a8c045760c5dcb05af1e8ed148df29c

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

Case digest / fd8ec0c0e3cead3b7b431841ed3c898259a22f6cd4a49a9dcb73253b7c3e7724