FAILURE MAP
← Case archive

FA-100491 / Sparse tensor canonicalization / Open access

Sparse tensor: transpose swaps shape but leaves coordinates unchanged · case 01

transpose swaps shape but leaves coordinates unchanged.

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

ROOT CAUSE

The COO row and column labels are copied unchanged when the tensor axes are transposed.

THE FAILURE

The COO row and column labels are copied unchanged when the tensor axes are transposed.

Unsuccessful approach: Sorting by original row-first order after swapping can leave entries grouped by their new column, so the result is not canonical row-major order.

Case contract

Transpose COO entries by swapping each row and column coordinate, then sort row-major.

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 sorted(entries)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('off diagonal',solve([[0,N+3,7],[N+1,1,3]]),[[1,N+1,3],[N+3,0,7]])
check('diagonal',solve([[N,N,4]]),[[N,N,4]])
check('empty',solve([]),[])
check('sort after swap',solve([[2,0,1],[1,2,5],[0,1,3]]),[[0,2,1],[1,0,3],[2,1,5]])
check('singleton',solve([[0,1,N]]),[[1,0,N]])
check('same transposed row',solve([[0,2,1],[1,2,4]]),[[2,0,1],[2,1,4]])
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
off diagonal[[0, 4, 7], [2, 1, 3]][[1, 2, 3], [4, 0, 7]]Failed
diagonal[[1, 1, 4]][[1, 1, 4]]Passed
empty[][]Passed
sort after swap[[0, 1, 3], [1, 2, 5], [2, 0, 1]][[0, 2, 1], [1, 0, 3], [2, 1, 5]]Failed
singleton[[0, 1, 1]][[1, 0, 1]]Failed
same transposed row[[0, 2, 1], [1, 2, 4]][[2, 0, 1], [2, 1, 4]]Failed

SHA-256 / 7e78799981f2afe75395fb4df7b1b0b9dc0298347b48109bff851097b9aa031a

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(entries):
    return sorted([[c,r,v] for r,c,v in entries],key=lambda x:(x[1],x[0]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('off diagonal',solve([[0,N+3,7],[N+1,1,3]]),[[1,N+1,3],[N+3,0,7]])
check('diagonal',solve([[N,N,4]]),[[N,N,4]])
check('empty',solve([]),[])
check('sort after swap',solve([[2,0,1],[1,2,5],[0,1,3]]),[[0,2,1],[1,0,3],[2,1,5]])
check('singleton',solve([[0,1,N]]),[[1,0,N]])
check('same transposed row',solve([[0,2,1],[1,2,4]]),[[2,0,1],[2,1,4]])
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
off diagonal[[4, 0, 7], [1, 2, 3]][[1, 2, 3], [4, 0, 7]]Failed
diagonal[[1, 1, 4]][[1, 1, 4]]Passed
empty[][]Passed
sort after swap[[1, 0, 3], [2, 1, 5], [0, 2, 1]][[0, 2, 1], [1, 0, 3], [2, 1, 5]]Failed
singleton[[1, 0, 1]][[1, 0, 1]]Passed
same transposed row[[2, 0, 1], [2, 1, 4]][[2, 0, 1], [2, 1, 4]]Passed

SHA-256 / eac7c40b7a4e70d6ffe41ee585e2ff2798617e273c53812a967de15aaa84b7a2

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

Case digest / 05e3d4ee94f7f07082f79a3e2efa7400bfa63bf3e7eb0949b930ffef7d6ac845