tf.constant([1, 2, 3, 4, 5, 6], dtype=tf.float64)<tf.Tensor: shape=(6,), dtype=float64, numpy=array([1., 2., 3., 4., 5., 6.])>
v = tf.Variable([0.0])with tf.GradientTape() as g: loss = tf.constant(v + v)g.gradient(loss, v).numpy()array([2.], dtype=float32)
with tf.compat.v1.Graph().as_default(): i = tf.compat.v1.placeholder(shape=[None, None], dtype=tf.float32) t = tf.constant(i)Traceback (most recent call last):TypeError: ...
with tf.compat.v1.Graph().as_default(): i = tf.compat.v1.placeholder(shape=[None, None], dtype=tf.float32) t = tf.convert_to_tensor(i)