File size: 1,233 Bytes
f25167e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | {
"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"
]
}
}
|