tf.ones returns zeros instead of ones
问题 Why is tf.ones returning zeros? My version is '2.3.0' and I'm using an Anaconda environment. import tensorflow as tf tf.ones((3, 3)) <tf.Tensor: shape=(3, 3), dtype=float32, numpy= array([[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]], dtype=float32)> I don't understand what's going on... But if I use dtype tf.int32 it works: tf.ones((3, 3), dtype=tf.int32) <tf.Tensor: shape=(3, 3), dtype=int32, numpy= array([[1, 1, 1], [1, 1, 1], [1, 1, 1]])> Someone here had the same issue. 回答1: Perhaps, your