I did the following simple calculation in TensorFlow and was surprised to see that the result is not as I expected. My code:
a = tf.constant([[0.2,1],[0.3,0.75]])
b = tf.constant([[0.2,0.1],[0.8,0.2]])
print(tf.square(a)+tf.square(b))
It delivers the result:
tf.Tensor(
[[0.08000001 1.01 ]
[0.73 0.6025 ]], shape=(2, 2), dtype=float32)
However, I would have expected:
tf.Tensor(
[[0.08 1.0 ]
[0.73 0.6025 ]], shape=(2, 2), dtype=float32)
since this would be the mathematically correct result of my calculation. What went wrong?