InvalidArgumentError: cannot compute Mul as input #1(zero-based) was expected to be a float tensor but is a double tensor [Op:Mul]

I am trying this demo: But a problem is:

I have tried various data types but have been unable to resolve them.


Hey @RX1,

Have you tried casting X_train as a float32 tensor? See tf.cast()

I have tried all the data types possible, but the problem still remains

In the code example you provided, you’re casting X_train as a double tensor, whereas Y_train is a float tensor. Can you try casting X_train as a float tensor? I.e. X_train = tf.cast(X_train, dtype=tf.float32).

you can try this demo

It doesn’t work. You can try this demo

@RX1 can you show me the output of your code when you define X_train as X_train = tf.cast(X_train, dtype=tf.float32)?