MCPcopy Index your code
hub / github.com/gpujs/gpu.js / inputZYX

Function inputZYX

test/features/input.js:200–213  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

198});
199
200function 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
215test("inputZYX auto", () => {
216 inputZYX();

Callers 1

input.jsFile · 0.85

Calls 5

createKernelMethod · 0.95
destroyMethod · 0.95
kernelFunction · 0.85
inputFunction · 0.85
setOutputMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…