MCPcopy
hub / github.com/gpujs/gpu.js / outputCube

Function outputCube

test/features/output.js:82–127  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

80});
81
82function outputCube(mode) {
83 const gpu = new GPU({ mode });
84 const input = [
85 [
86 [1,2,3,4,5],
87 [1,2,3,4,5],
88 [1,2,3,4,5],
89 [1,2,3,4,5],
90 [1,2,3,4,5],
91 ],
92 [
93 [1,2,3,4,5],
94 [1,2,3,4,5],
95 [1,2,3,4,5],
96 [1,2,3,4,5],
97 [1,2,3,4,5],
98 ],
99 [
100 [1,2,3,4,5],
101 [1,2,3,4,5],
102 [1,2,3,4,5],
103 [1,2,3,4,5],
104 [1,2,3,4,5],
105 ],
106 [
107 [1,2,3,4,5],
108 [1,2,3,4,5],
109 [1,2,3,4,5],
110 [1,2,3,4,5],
111 [1,2,3,4,5],
112 ],
113 [
114 [1,2,3,4,5],
115 [1,2,3,4,5],
116 [1,2,3,4,5],
117 [1,2,3,4,5],
118 [1,2,3,4,5],
119 ]
120 ];
121 const kernel = gpu.createKernel(function(input) {
122 return input[this.thread.z][this.thread.y][this.thread.x];
123 }, { output: [5, 5, 5] });
124 const result = kernel(input);
125 assert.deepEqual(result.map(matrix => matrix.map(array => Array.from(array))), input);
126 gpu.destroy();
127}
128
129test('output cube auto', () => {
130 outputCube();

Callers 1

output.jsFile · 0.85

Calls 3

createKernelMethod · 0.95
destroyMethod · 0.95
kernelFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…