tensorflow tf.shape()与tensor.get_shape()
相同點
两种方法都可以获得变量的shape。
不同點
tf.shape(x):返回tensor。如果在运行的时候想知道None到底是多少,这时候,只能通过tf.shape(x)[0]讀取。
tensor.get_shape():返回tuple。無法讀取None。
tensorflow tf.shape()与tensor.get_shape()
相同點
两种方法都可以获得变量的shape。
不同點
tf.shape(x):返回tensor。如果在运行的时候想知道None到底是多少,这时候,只能通过tf.shape(x)[0]讀取。
tensor.get_shape():返回tuple。無法讀取None。