| { | |
| "name": "loop_038", | |
| "op_type": "loop_038", | |
| "description": "1D convolution of an FP16 signal with an FP16 filter kernel", | |
| "tags": [ | |
| "simd-loop" | |
| ], | |
| "axes": { | |
| "dim": { | |
| "type": "var", | |
| "description": "axis dim" | |
| } | |
| }, | |
| "inputs": { | |
| "a": { | |
| "shape": [ | |
| "dim", | |
| "dim" | |
| ], | |
| "dtype": "float16" | |
| }, | |
| "b": { | |
| "shape": [ | |
| "dim", | |
| "dim" | |
| ], | |
| "dtype": "float16" | |
| } | |
| }, | |
| "outputs": { | |
| "c": { | |
| "shape": [ | |
| "dim", | |
| "dim" | |
| ], | |
| "dtype": "float16", | |
| "description": "Output array" | |
| } | |
| }, | |
| "reference": "import numpy as np\n\ndef run(a, b):\n dim = a.shape[0]\n c = np.zeros((dim, dim), dtype=np.float16)\n if dim >= 2:\n k = np.float16(0.25)\n s0 = a[:-1, :-1]; s1 = a[:-1, 1:]; s2 = a[1:, :-1]; s3 = a[1:, 1:]\n r = (b[:-1, :-1] + s0 * k).astype(np.float16)\n r = (r + s1 * k).astype(np.float16)\n r = (r + s2 * k).astype(np.float16)\n r = (r + s3 * k).astype(np.float16)\n c[:-1, :-1] = r\n return c\n", | |
| "simd_loop_meta": { | |
| "output_inplace": false, | |
| "array_pad": 0, | |
| "scratch": [], | |
| "axes_order": [ | |
| "dim" | |
| ] | |
| } | |
| } | |