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

Function dynamicOutput3DShrinks

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

Source from the content-addressed store, hash-verified

588
589
590function dynamicOutput3DShrinks(mode) {
591 const gpu = new GPU({ mode });
592 const kernel = gpu.createKernel(function() {
593 return this.output.x + this.output.y + this.thread.z + this.thread.x + this.thread.y + this.thread.z;
594 }, { dynamicOutput: true });
595
596 kernel.setOutput([3,3,3]);
597 let result = kernel();
598 assert.equal(result.length, 3);
599 assert.deepEqual(result.map(matrix => matrix.map(row => Array.from(row))), [
600 [
601 [6,7,8],
602 [7,8,9],
603 [8,9,10]
604 ],
605 [
606 [8,9,10],
607 [9,10,11],
608 [10,11,12]
609 ],
610 [
611 [10,11,12],
612 [11,12,13],
613 [12,13,14]
614 ]
615 ]);
616 assert.deepEqual(Array.from(kernel.output), [3,3,3]);
617
618 kernel.setOutput([2,2,2]);
619 result = kernel();
620 assert.equal(result.length, 2);
621 assert.deepEqual(result.map(matrix => matrix.map(row => Array.from(row))), [[[4,5],[5,6]],[[6,7],[7,8]]]);
622 assert.deepEqual(Array.from(kernel.output), [2,2,2]);
623
624 gpu.destroy();
625}
626
627test('dynamic output 3d shrinks auto', () => {
628 dynamicOutput3DShrinks();

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…