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

Function dynamicOutput2DShrinks

test/features/dynamic-output.js:250–269  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

248
249
250function dynamicOutput2DShrinks(mode) {
251 const gpu = new GPU({ mode });
252 const kernel = gpu.createKernel(function() {
253 return this.output.x + this.output.y + this.thread.x + this.thread.y;
254 }, { dynamicOutput: true });
255
256 kernel.setOutput([3,3]);
257 let result = kernel();
258 assert.equal(result.length, 3);
259 assert.deepEqual(result.map(row => Array.from(row)), [[6,7,8],[7,8,9],[8,9,10]]);
260 assert.deepEqual(Array.from(kernel.output), [3,3]);
261
262 kernel.setOutput([2,2]);
263 result = kernel();
264 assert.equal(result.length, 2);
265 assert.deepEqual(result.map(row => Array.from(row)), [[4,5],[5,6]]);
266 assert.deepEqual(Array.from(kernel.output), [2,2]);
267
268 gpu.destroy();
269}
270
271test('dynamic output 2d shrinks auto', () => {
272 dynamicOutput2DShrinks();

Callers 1

dynamic-output.jsFile · 0.85

Calls 4

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…