I'd like to clip some Tensorflow variables with tf.clip_by_value to the most positive / negative finite value possible. I'd like to reach a similar behavior like numpy.nan_to_num()
How do I get these values, given some data type? Does this clipping affect the optimizer?
All TensorFlow datatypes have the min and max properties, that return the maximum and minimum values the type can hold. E.g.,
import tensorflow as tf
print( tf.float32.max )
Outputs:
3.4028235e+38
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With