{"abstract":"reshape inferred dimension uses exact element count.","category":"Tensor stride and reshape semantics","checks":6,"contract":"Infer one -1 dimension from element count; reject nonintegral inference is outside contract.","contract_signature":"shape, target","evaluation_group":"tensor-reshape-infer","failed_approach":"Using only one input axis gives the right answer for some shapes but fails flattening.","family":"w3-tensor-stride-reshape-reshape-infer","id":"FA-98766","implementations":{"attempt":{"sha256":"6c09eb8a0cd26b07477d92be2c3cc9c1280220f6d6a83bdce6b9a6e17278282d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(shape, target):\n    total=1\n    for d in shape: total*=d\n    out=list(target)\n    for i,d in enumerate(out):\n     if d==-1: out[i]=total//(out[i-1] if i else 1); break\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('matrix to rows',solve([N,3],[-1,3]),[N,3])\ncheck('flatten',solve([2,N],[-1]),[2*N])\ncheck('infer leading',solve([2,3],[-1,2]),[3,2])\ncheck('no inference',solve([2,3],[3,2]),[3,2])\ncheck('unit count',solve([1],[-1,1]),[1,1])\ncheck('rank zero target',solve([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":"1ca7046d6fc3c9ccc15430c45cf35df71e40434454698df1308c3e0c02c777c4","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(shape, target):\n    return [shape[0] if d==-1 else d for d in target]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('matrix to rows',solve([N,3],[-1,3]),[N,3])\ncheck('flatten',solve([2,N],[-1]),[2*N])\ncheck('infer leading',solve([2,3],[-1,2]),[3,2])\ncheck('no inference',solve([2,3],[3,2]),[3,2])\ncheck('unit count',solve([1],[-1,1]),[1,1])\ncheck('rank zero target',solve([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-reshape-infer","generated_at":"2026-09-30T16:48:16.724948+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":"The inferred size is copied from one input axis instead of derived from total element count.","sha256":"f25f0c2ac5f8fd81a059ffe9bf1fff7373735f88594ba4fa60fdfc2d6429a208","title":"Tensor views: reshape inferred dimension uses exact element count · 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":27.251,"exit_code":1,"observations":[{"actual":[3,3],"check":"matrix to rows","expected":[1,3],"passed":false},{"actual":[2],"check":"flatten","expected":[2],"passed":true},{"actual":[6,2],"check":"infer leading","expected":[3,2],"passed":false},{"actual":[3,2],"check":"no inference","expected":[3,2],"passed":true},{"actual":[1,1],"check":"unit count","expected":[1,1],"passed":true},{"actual":[],"check":"rank zero target","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"matrix to rows\", \"actual\": [3, 3], \"expected\": [1, 3], \"passed\": false}, {\"check\": \"flatten\", \"actual\": [2], \"expected\": [2], \"passed\": true}, {\"check\": \"infer leading\", \"actual\": [6, 2], \"expected\": [3, 2], \"passed\": false}, {\"check\": \"no inference\", \"actual\": [3, 2], \"expected\": [3, 2], \"passed\": true}, {\"check\": \"unit count\", \"actual\": [1, 1], \"expected\": [1, 1], \"passed\": true}, {\"check\": \"rank zero target\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":27.004,"exit_code":1,"observations":[{"actual":[1,3],"check":"matrix to rows","expected":[1,3],"passed":true},{"actual":[2],"check":"flatten","expected":[2],"passed":true},{"actual":[2,2],"check":"infer leading","expected":[3,2],"passed":false},{"actual":[3,2],"check":"no inference","expected":[3,2],"passed":true},{"actual":[1,1],"check":"unit count","expected":[1,1],"passed":true},{"actual":[],"check":"rank zero target","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"matrix to rows\", \"actual\": [1, 3], \"expected\": [1, 3], \"passed\": true}, {\"check\": \"flatten\", \"actual\": [2], \"expected\": [2], \"passed\": true}, {\"check\": \"infer leading\", \"actual\": [2, 2], \"expected\": [3, 2], \"passed\": false}, {\"check\": \"no inference\", \"actual\": [3, 2], \"expected\": [3, 2], \"passed\": true}, {\"check\": \"unit count\", \"actual\": [1, 1], \"expected\": [1, 1], \"passed\": true}, {\"check\": \"rank zero target\", \"actual\": [], \"expected\": [], \"passed\": true}], \"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."}}