FAILURE MAP
← Case archive

FA-100531 / Sparse tensor canonicalization / Open access

Sparse tensor: negative COO coordinates are accepted as Python indices · case 01

negative COO coordinates are accepted as Python indices.

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

ROOT CAUSE

Coordinate validity requires lower as well as strict upper bounds on both axes.

THE FAILURE

Coordinate validity requires lower as well as strict upper bounds on both axes.

Unsuccessful approach: An index equal to the extent is outside the tensor shape.

Case contract

Return only entries whose row and column satisfy 0<=row<rows and 0<=column<cols.

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):
    return [e for e in entries if e[0]<rows and e[1]<cols]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative row',solve([[-1,0,4],[0,0,5]],1,1),[[0,0,5]])
check('upper boundary',solve([[1,0,3],[0,1,4]],1,1),[])
check('empty dimensions',solve([[0,0,7]],0,2),[])
check('valid corner',solve([[N-1,N-1,8]],N,N),[[N-1,N-1,8]])
check('negative column',solve([[0,-1,9]],2,2),[])
check('empty entries',solve([],N,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
negative row[[-1, 0, 4], [0, 0, 5]][[0, 0, 5]]Failed
upper boundary[][]Passed
empty dimensions[][]Passed
valid corner[[0, 0, 8]][[0, 0, 8]]Passed
negative column[[0, -1, 9]][]Failed
empty entries[][]Passed

SHA-256 / 13514083686386f6e59bfd693d5d2e42a5a30c5eb4b11bdb4fd253b67bf55334

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(entries,rows,cols):
    return [e for e in entries if 0<=e[0]<=rows and 0<=e[1]<=cols]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative row',solve([[-1,0,4],[0,0,5]],1,1),[[0,0,5]])
check('upper boundary',solve([[1,0,3],[0,1,4]],1,1),[])
check('empty dimensions',solve([[0,0,7]],0,2),[])
check('valid corner',solve([[N-1,N-1,8]],N,N),[[N-1,N-1,8]])
check('negative column',solve([[0,-1,9]],2,2),[])
check('empty entries',solve([],N,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
negative row[[0, 0, 5]][[0, 0, 5]]Passed
upper boundary[[1, 0, 3], [0, 1, 4]][]Failed
empty dimensions[[0, 0, 7]][]Failed
valid corner[[0, 0, 8]][[0, 0, 8]]Passed
negative column[][]Passed
empty entries[][]Passed

SHA-256 / 779812dc066cfff961ab1433205b68f7b57c524430f9da4128967861e79fbb2d

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

Case digest / c3c4ccfbbdbdcf811aa6cdd2bb76275d21c71de6df29b576d0cd242f9f5e9204