import tensorflow as tf tf.enable_eager_execution() x = tf.random_normal(shape=[1, 3, 1]) print(x) print('"""""""""') x = tf.reshape(x, shape=(-1, 3)) print(x) print('"""""""""') # 用于得到一個tensor的list x = tf.split(x, 3, 1) print(x) print(type(x)) tf.Tensor( [[[-0.3549296] [-1.2164379] [-1.1886832]]], shape=(1, 3, 1), dtype=float32) """"""""" tf.Tensor([[-0.3549296 -1.2164379 -1.1886832]], shape=(1, 3), dtype=float32) """"""""" [<tf.Tensor: id=12, shape=(1, 1), dtype=float32, numpy=array([[-0.3549296]], dtype=float32)>, <tf.Tensor: id=13, shape=(1, 1), dtype=float32, numpy=array([[-1.2164379]], dtype=float32)>, <tf.Tensor: id=14, shape=(1, 1), dtype=float32, numpy=array([[-1.1886832]], dtype=float32)>] <class 'list'>