How to get the dimensions of a tensor (in TensorFlow) at graph construction time?

后端 未结 6 894
你的背包
你的背包 2021-01-30 20:54

I am trying an Op that is not behaving as expected.

graph = tf.Graph()
with graph.as_default():
  train_dataset = tf.placeholder(tf.int32, shape=[128, 2])
  embe         


        
6条回答
  •  感情败类
    2021-01-30 21:33

    Tensor.get_shape() from this post.

    From documentation:

    c = tf.constant([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
    print(c.get_shape())
    ==> TensorShape([Dimension(2), Dimension(3)])
    

提交回复
热议问题