{"abstract":"unsqueeze inserts a unit dimension at normalized axis.","category":"Tensor stride and reshape semantics","checks":6,"contract":"Insert size one and a contiguous-compatible stride: at end stride 1, otherwise shape[a]*stride[a].","contract_signature":"shape, strides, axis","evaluation_group":"tensor-unsqueeze-axis","failed_approach":"Looking at the preceding axis selects the wrong layout for middle and trailing insertions.","family":"w3-tensor-stride-reshape-unsqueeze-axis","id":"FA-98791","implementations":{"attempt":{"sha256":"ca33d53e14be5ee40279eb238bc76aace2bcc9ee79c8c9e5cef7ec2c616a5479","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(shape, strides, axis):\n    out=list(shape); s=list(strides); stride=shape[axis-1]*strides[axis-1] if axis else 1\n    out.insert(axis,1); s.insert(axis,stride)\n    return out,s\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('leading',solve([N,3],[3,1],0),([1,N,3],[N*3,3,1]))\ncheck('middle',solve([2,3],[3,1],1),([2,1,3],[3,3,1]))\ncheck('trailing',solve([2,3],[3,1],2),([2,3,1],[3,1,1]))\ncheck('noncontiguous',solve([2,3],[7,2],1),([2,1,3],[7,6,2]))\ncheck('scalar',solve([] ,[],0),([1],[1]))\ncheck('offset-compatible units',solve([1,3],[99,1],0),([1,1,3],[99,99,1]))\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"76206c97870a8ab1751e0f24c5dcdd8c3a781760a94364f6713c6cf3e9b0fa21","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(shape, strides, axis):\n    out=list(shape); out.insert(axis,1)\n    s=list(strides); s.insert(axis,1)\n    return out,s\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('leading',solve([N,3],[3,1],0),([1,N,3],[N*3,3,1]))\ncheck('middle',solve([2,3],[3,1],1),([2,1,3],[3,3,1]))\ncheck('trailing',solve([2,3],[3,1],2),([2,3,1],[3,1,1]))\ncheck('noncontiguous',solve([2,3],[7,2],1),([2,1,3],[7,6,2]))\ncheck('scalar',solve([] ,[],0),([1],[1]))\ncheck('offset-compatible units',solve([1,3],[99,1],0),([1,1,3],[99,99,1]))\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"Self-contained integer metadata models only; no production framework compatibility or performance claim. 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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w3-tensor-stride-reshape-unsqueeze-axis","generated_at":"2026-09-30T16:48:16.725026+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Dense tensor views rely on consistent logical coordinates and physical storage addresses.","root_cause":"A new unit axis receives a fixed stride rather than one compatible with its insertion point.","sha256":"b37e88f24d48b0006de42702ae3e7fc5b3010443af1bf1e7ac2d0c89ac1a3495","title":"Tensor views: unsqueeze inserts a unit dimension at normalized axis · case 01","variant":1,"variant_policy":"The fixture code references N, supplied as 1 through 5. Fixed boundary checks may repeat. These records share one mechanism and must remain together in evaluation splits.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":26.112,"exit_code":1,"observations":[{"actual":[[1,1,3],[1,3,1]],"check":"leading","expected":[[1,1,3],[3,3,1]],"passed":false},{"actual":[[2,1,3],[3,6,1]],"check":"middle","expected":[[2,1,3],[3,3,1]],"passed":false},{"actual":[[2,3,1],[3,1,3]],"check":"trailing","expected":[[2,3,1],[3,1,1]],"passed":false},{"actual":[[2,1,3],[7,14,2]],"check":"noncontiguous","expected":[[2,1,3],[7,6,2]],"passed":false},{"actual":[[1],[1]],"check":"scalar","expected":[[1],[1]],"passed":true},{"actual":[[1,1,3],[1,99,1]],"check":"offset-compatible units","expected":[[1,1,3],[99,99,1]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"leading\", \"actual\": [[1, 1, 3], [1, 3, 1]], \"expected\": [[1, 1, 3], [3, 3, 1]], \"passed\": false}, {\"check\": \"middle\", \"actual\": [[2, 1, 3], [3, 6, 1]], \"expected\": [[2, 1, 3], [3, 3, 1]], \"passed\": false}, {\"check\": \"trailing\", \"actual\": [[2, 3, 1], [3, 1, 3]], \"expected\": [[2, 3, 1], [3, 1, 1]], \"passed\": false}, {\"check\": \"noncontiguous\", \"actual\": [[2, 1, 3], [7, 14, 2]], \"expected\": [[2, 1, 3], [7, 6, 2]], \"passed\": false}, {\"check\": \"scalar\", \"actual\": [[1], [1]], \"expected\": [[1], [1]], \"passed\": true}, {\"check\": \"offset-compatible units\", \"actual\": [[1, 1, 3], [1, 99, 1]], \"expected\": [[1, 1, 3], [99, 99, 1]], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":26.442,"exit_code":1,"observations":[{"actual":[[1,1,3],[1,3,1]],"check":"leading","expected":[[1,1,3],[3,3,1]],"passed":false},{"actual":[[2,1,3],[3,1,1]],"check":"middle","expected":[[2,1,3],[3,3,1]],"passed":false},{"actual":[[2,3,1],[3,1,1]],"check":"trailing","expected":[[2,3,1],[3,1,1]],"passed":true},{"actual":[[2,1,3],[7,1,2]],"check":"noncontiguous","expected":[[2,1,3],[7,6,2]],"passed":false},{"actual":[[1],[1]],"check":"scalar","expected":[[1],[1]],"passed":true},{"actual":[[1,1,3],[1,99,1]],"check":"offset-compatible units","expected":[[1,1,3],[99,99,1]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"leading\", \"actual\": [[1, 1, 3], [1, 3, 1]], \"expected\": [[1, 1, 3], [3, 3, 1]], \"passed\": false}, {\"check\": \"middle\", \"actual\": [[2, 1, 3], [3, 1, 1]], \"expected\": [[2, 1, 3], [3, 3, 1]], \"passed\": false}, {\"check\": \"trailing\", \"actual\": [[2, 3, 1], [3, 1, 1]], \"expected\": [[2, 3, 1], [3, 1, 1]], \"passed\": true}, {\"check\": \"noncontiguous\", \"actual\": [[2, 1, 3], [7, 1, 2]], \"expected\": [[2, 1, 3], [7, 6, 2]], \"passed\": false}, {\"check\": \"scalar\", \"actual\": [[1], [1]], \"expected\": [[1], [1]], \"passed\": true}, {\"check\": \"offset-compatible units\", \"actual\": [[1, 1, 3], [1, 99, 1]], \"expected\": [[1, 1, 3], [99, 99, 1]], \"passed\": false}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}