1. import tensorflow as tf
    2. tf.__version__
    3. node1 = tf.constant(100)
    4. node2 = tf.constant([1,2,3,4,5])
    5. node3 = tf.constant([[1,2],[3,4],[5,6]])
    6. node4 = tf.constant([[[1],[2],[3],[4]]])
    7. print(node1.shape)
    8. print(node2.shape)
    9. print(node3.shape)
    10. print(node4.shape)
    11. //结果
    12. ()
    13. (5,)
    14. (3, 2)
    15. (1, 4, 1)

    是由表及里的,例如node4最外层括号里面只有一个[[开头的。