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

Function testSinglePrecisionMatrix

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

Source from the content-addressed store, hash-verified

1094});
1095
1096function testSinglePrecisionMatrix(mode) {
1097 const gpu = new GPU({ mode });
1098 const kernel = gpu.createKernel(function(input) {
1099 return input[this.thread.y][this.thread.x];
1100 })
1101 .setDynamicArguments(true)
1102 .setDynamicOutput(true)
1103 .setOutput([4,4]);
1104
1105 let matrix = [
1106 [1,2,3,4],
1107 [5,6,7,8],
1108 [9,10,11,12],
1109 [13,14,15,16]
1110 ];
1111 assert.deepEqual(kernel(matrix), matrix.map(row => new Float32Array(row)));
1112
1113 kernel.setOutput([3,3]);
1114 matrix = [
1115 [1,2,3],
1116 [4,5,6],
1117 [7,8,9]
1118 ];
1119 assert.deepEqual(kernel(matrix), matrix.map(row => new Float32Array(row)));
1120
1121 kernel.setOutput([2,2]);
1122 matrix = [
1123 [1,2],
1124 [3,4]
1125 ];
1126 assert.deepEqual(kernel(matrix), matrix.map(row => new Float32Array(row)));
1127 gpu.destroy();
1128}
1129
1130(GPU.isSinglePrecisionSupported ? test : skip)('single precision Matrix auto', () => {
1131 testSinglePrecisionMatrix();

Callers 1

Calls 6

createKernelMethod · 0.95
destroyMethod · 0.95
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…