tf.argMax appears to have a strange bug. The following code snippet prints Tensor 0 when it should print Tensor 44.
const xarr = new Float32Array(88);
xarr[44] = 1.
const x = tf.tensor1d(xarr);
const xam = tf.argMax(x)
xam.print()
Changing the number 44 in this code snippet to any other number in [0, 87] results in the correct output. Disabling my GPU (by turning off hardware acceleration in Chrome) fixes the bug.
The only thing that comes to mind about the significance of the number 44 is that it is half of 88, the size of the tensor. Indeed, this bug holds for 86/43 and 84/42.
0.12.5
Version 68.0.3440.106
I can reproduce this and can confirm that it only seems to affect the webgl backend. Thanks for reporting the bug, we will take a look.
Cool, thx!
Hey guys. I investigated this a bit, and tracked it down to just be a small initialization error in the GLSL code.
Most helpful comment
Hey guys. I investigated this a bit, and tracked it down to just be a small initialization error in the GLSL code.