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

Function testSinglePrecisionInputMatrix

test/features/dynamic-arguments.js:1225–1269  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

1223});
1224
1225function testSinglePrecisionInputMatrix(mode) {
1226 const gpu = new GPU({ mode });
1227 const kernel = gpu.createKernel(function(input) {
1228 return input[this.thread.y][this.thread.x];
1229 })
1230 .setDynamicArguments(true)
1231 .setDynamicOutput(true)
1232 .setOutput([4,4]);
1233
1234 let matrix = input([
1235 1,2,3,4,
1236 5,6,7,8,
1237 9,10,11,12,
1238 13,14,15,16
1239 ], [4, 4]);
1240 assert.deepEqual(kernel(matrix), [
1241 new Float32Array([1,2,3,4]),
1242 new Float32Array([5,6,7,8]),
1243 new Float32Array([9,10,11,12]),
1244 new Float32Array([13,14,15,16])
1245 ]);
1246
1247 kernel.setOutput([3,3]);
1248 matrix = input([
1249 1,2,3,
1250 4,5,6,
1251 7,8,9
1252 ], [3, 3]);
1253 assert.deepEqual(kernel(matrix), [
1254 new Float32Array([1,2,3]),
1255 new Float32Array([4,5,6]),
1256 new Float32Array([7,8,9])
1257 ]);
1258
1259 kernel.setOutput([2,2]);
1260 matrix = input([
1261 1,2,
1262 3,4
1263 ], [2,2]);
1264 assert.deepEqual(kernel(matrix), [
1265 new Float32Array([1,2]),
1266 new Float32Array([3,4])
1267 ]);
1268 gpu.destroy();
1269}
1270
1271(GPU.isSinglePrecisionSupported ? test : skip)('single precision Input Matrix auto', () => {
1272 testSinglePrecisionInputMatrix();

Callers 1

Calls 7

createKernelMethod · 0.95
destroyMethod · 0.95
inputFunction · 0.85
kernelFunction · 0.85
setDynamicOutputMethod · 0.80
setDynamicArgumentsMethod · 0.80
setOutputMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…