| { | |
| "name": "loop_010", | |
| "op_type": "loop_010", | |
| "description": "Find the last active element of an FP array under a computed predicate", | |
| "tags": [ | |
| "simd-loop" | |
| ], | |
| "axes": { | |
| "N": { | |
| "type": "var", | |
| "description": "Array length" | |
| } | |
| }, | |
| "inputs": { | |
| "a": { | |
| "shape": [ | |
| "N" | |
| ], | |
| "dtype": "float32" | |
| } | |
| }, | |
| "outputs": { | |
| "res": { | |
| "shape": null, | |
| "dtype": "int32", | |
| "description": "Scalar result" | |
| } | |
| }, | |
| "reference": "import numpy as np\n\ndef run(a):\n any_neg = bool(np.any(a < 0))\n all_neg = bool(np.all(a < 0))\n return np.int32(1 if all_neg else (2 if any_neg else 3))\n", | |
| "simd_loop_meta": { | |
| "output_inplace": false, | |
| "array_pad": 0, | |
| "scratch": [] | |
| } | |
| } | |