| 198 | }); |
| 199 | |
| 200 | function inputZYX(mode) { |
| 201 | const gpu = new GPU({ mode }); |
| 202 | const kernel = gpu.createKernel(function(a) { |
| 203 | return a[this.thread.z][this.thread.y][this.thread.x]; |
| 204 | }) |
| 205 | .setOutput([2, 4, 4]); |
| 206 | |
| 207 | const a = new Float32Array(32); |
| 208 | a.set([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]); |
| 209 | |
| 210 | const result = kernel(input(a, [2, 4, 4])); |
| 211 | assert.deepEqual(result.map(function(v) { return v.map(function(v) { return Array.from(v); }); }), [[[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]]]); |
| 212 | gpu.destroy(); |
| 213 | } |
| 214 | |
| 215 | test("inputZYX auto", () => { |
| 216 | inputZYX(); |