Giving error while processing float values

   def gaussian_exp(inp_val):
        """
        Expand values to gaussian basis

        """
        guass_filter = tf.range(-5, 5 + 1, 1)
        return tf.math.exp(-(tf.expand_dims(inp_val, axis=-1) - guass_filter)**2 /(1**2))

The above code works fine for integer values, but gives an error while processing float values, any idea?

It Is explained in the doc as a constrain:

https://www.tensorflow.org/api_docs/python/tf/math/exp#args

1 Like