| { | |
| "name": "loop_102", | |
| "op_type": "loop_102", | |
| "description": "Count the frequency of each byte value in a large buffer (histogram)", | |
| "tags": [ | |
| "simd-loop" | |
| ], | |
| "axes": { | |
| "num_records": { | |
| "type": "var", | |
| "description": "axis num_records" | |
| }, | |
| "histogram_size": { | |
| "type": "const", | |
| "value": 128, | |
| "description": "const histogram_size" | |
| } | |
| }, | |
| "inputs": { | |
| "records": { | |
| "shape": [ | |
| "num_records" | |
| ], | |
| "dtype": "uint32" | |
| } | |
| }, | |
| "outputs": { | |
| "histogram": { | |
| "shape": [ | |
| "histogram_size" | |
| ], | |
| "dtype": "uint32", | |
| "description": "Output array" | |
| } | |
| }, | |
| "reference": "import numpy as np\n\ndef run(records):\n return np.bincount(records.astype(np.int64), minlength=128)[:128].astype(np.uint32)\n", | |
| "simd_loop_meta": { | |
| "output_inplace": false, | |
| "array_pad": 0, | |
| "scratch": [], | |
| "axes_order": [ | |
| "histogram_size", | |
| "num_records" | |
| ] | |
| } | |
| } | |