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

Function inputYX

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

Source from the content-addressed store, hash-verified

82});
83
84function inputYX(mode) {
85 const gpu = new GPU({ mode });
86 const kernel = gpu.createKernel(function(a) {
87 return a[this.thread.y][this.thread.x];
88 })
89 .setOutput([3, 3]);
90
91 const a = new Float32Array(9);
92 a.set([1,2,3,4,5,6,7,8,9]);
93
94 const result = kernel(input(a, [3, 3]));
95 assert.deepEqual(result.map(function(v) { return Array.from(v); }), [[1,2,3],[4,5,6],[7,8,9]]);
96 gpu.destroy();
97}
98
99test("inputYX auto", () => {
100 inputYX();

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…