Skip to content
This repository was archived by the owner on Aug 15, 2019. It is now read-only.

Commit bd3c241

Browse files
authored
Change matMul expression to fix Windows inconsistency. (#1845)
BUG
1 parent c01c866 commit bd3c241

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/backends/webgl/mulmat_packed_gpu.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export class MatMulPackedProgram implements GPGPUProgram {
2525

2626
constructor(
2727
aShape: [number, number, number], outputShape: [number, number, number],
28-
transposeA = false, transposeB = false,
29-
addBias = false, activation: string = null) {
28+
transposeA = false, transposeB = false, addBias = false,
29+
activation: string = null) {
3030
this.outputShape = outputShape;
3131

3232
const sharedDim = transposeA ? aShape[1] : aShape[2];
@@ -62,8 +62,10 @@ export class MatMulPackedProgram implements GPGPUProgram {
6262
vec4 a = getMatrixA(rc.x, ${aSample});
6363
vec4 b = getMatrixB(rc.x, ${bSample});
6464
65-
result += (${aSwizzle[0]} * ${bSwizzle[0]}) + (${aSwizzle[1]} * ${
66-
bSwizzle[1]});
65+
// These swizzled products need to be separately added.
66+
// See: https://github.com/tensorflow/tfjs/issues/1735
67+
result += (${aSwizzle[0]} * ${bSwizzle[0]});
68+
result += (${aSwizzle[1]} * ${bSwizzle[1]});
6769
}
6870
return result;
6971
}

0 commit comments

Comments
 (0)