Inputs not matching

def multiply(x):
    return tf.math.multiply(x=x[0, :], y= x[1, 0])

inputs = Input(shape=(2, ))
r= Dense(units=1, activation=multiply)(inputs)
fr = Dense(units=1, activation='relu', )(r)
...

When running this code I get the following error:
ValueError: Input 0 of layer dense_38 is incompatible with the layer: : expected min_ndim=2, found ndim=1. Full shape received: (1,)

I do not understand why it is expecting a two dimensional input

Hi @Francois_Laurent, You are getting this error due to the activation multiply(x).For example,

x=np. array([5.1, 3.5])
print("shape=",x.shape)
multiply(x)
#output
shape= (2,)
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
x=np. array([[5.1,],[3.5])
print("shape=",x.shape)
multiply(x)
#output
shape= (2, 1)
<tf.Tensor: shape=(1,), dtype=float64, numpy=array([17.85])>

Thank You.