Can we use tf.experimental.numpy with Keras Functional API?
When I create the following code:
inp1 = keras.layers.Input(shape=(1,), name=“inp1”)
inp2 = keras.layers.Input(shape=(1,), name=“inp2”)
out = tf.experimental.numpy.add(inp1, inp2)
m = keras.Model([inp1, inp2], out)
I get the following error:
Cannot interpret '<KerasTensor: shape=(None, 1) dtype=float32 (created by layer 'inp1')>' as a data type
Whereas when I use
out = tf.math.add(inp1, inp2), there is no issue.
What could be the problem please?
PS: The use case that I have is to calculate the mean of a tensor ignoring all nan values. That’s why I was trying to use tf.experimental.numpy.nanmean which gave the same error.