tf.isNaN misbehaves in browsers

Hi there,
I’ve noticed that the isNaN examples (at least in the 4.2.0 API description) don’t work as expected in the browser: TensorFlow.js API If you press run, the expected behavior would be to return ‘true’ in the first element of the return tensor, but instead, everything is ‘false’:

const x = tf.tensor1d([NaN, Infinity, -Infinity, 0, 1]);
​x.isNaN().print();  // or tf.isNaN(x)
Tensor
    [false, false, false, false, false]

It behaves the same way in my other installed browsers:

  • Chrome: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
  • Edge: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.76
  • Firefox: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0

However, if I start it in Node.JS (v16.14.0,), the answers are the ones expected:

Tensor
    [true, false, false, false, false]

.isInf() works just fine both in the browser and in Node. Can somebody confirm, if the problem is really there? If yes, I’ll report a bug.

Thanks,

hp