Home > Software engineering >  Smallest positive float64 number in TensorFlow
Smallest positive float64 number in TensorFlow

Time:04-11

How one can get the smallest positive float value in TensorFLow?

In numpy one can use np.nextafter and do something like:

>>> import numpy as np
>>> np.nextafter(0, 1)
4.9406564584124654e-324

CodePudding user response:

For this, Tensorflow has tf.math.nexafter. See here: TensorFlow doc

(It's actually unsurprising that TensoFlow is very similar to Numpy here, since the mathematics of Tensorflow are based on those of Numpy, and you can easily use np arrays as data input in tf.)

  • Related