关于使用tensorflow加载图片获取图片维度的问题

官方文档上的一段代码:

def image_example(image_string, label):
  image_shape = tf.image.decode_jpeg(image_string).shape

  feature = {
      'height': _int64_feature(image_shape[0]),
      'width': _int64_feature(image_shape[1]),
      'depth': _int64_feature(image_shape[2]),
      'label': _int64_feature(label),
      'image_raw': _bytes_feature(image_string),
  }

  return tf.train.Example(features=tf.train.Features(feature=feature))

这是把图片数据做成TFRecord的一部分代码,问题在第二行那里,求图片的维度是通过解码运算节点来获取的,然而这样的话直接print后得到的是(?, ?, ?),必须在Session中通过显示调用eval()后才能得到正确的shape,想问问是官方文档的问题还是我的问题?

https://blog.csdn.net/qq_30638831/article/details/83450136