I am creating a function that takes a tensor value and returns the result by applying the following formulation, There are 3 conditions so I am using @tf.functions.
def Spa(x):
x= tf.convert_to_tensor(float(x), dtype=tf.float32)
p= tf.convert_to_tensor(float(0.05), dtype=tf.float32)
p_dash=x
K = p*logp_dash
Ku=K.sum(Ku)
Ku= tf.convert_to_tensor(float(Ku), dtype=tf.float32)
y= tf.convert_to_tensor(float(0), dtype=tf.float32)
def a(): return tf.constant(0)
r = tf.case([(tf.less(x, y), a), (tf.greater(x, Ku), a)], default=x, exclusive=False)
return r
The code generates the following error: 'false_fn' must be callable. I did many conversions, int to float and float to int but don't know what is the issue.
It should be something like this.