Recently, TF. In tensorflow has been used The summary module is debugged to print the shape and value of the tensor you want to see when the main program runs
Although tensorflow version 1.15.5 is used, even tf.enable_eager_execution() also cannot see the length of the actual dimensions of the tensor.
TF Code of summary section:
edges_0_shape = tf.Print(tf.shape(edges_0), [tf.shape(edges_0)]) tf.summary.scalar('shape_edges_0', edges_0_shape)
Error message:
tensorflow.python.framework.errors_impl.InvalidArgumentError: tags and values not the same shape: [] != [2]
Explanation: edges_0 is a tensor and a two-dimensional tensor, so TF The return value of shape (edges_0) is a one-dimensional tensor such as [100, 50], so TF.summary.tensor_Summary () should be used, not TF.summary. scalar()
After modification:
edges_0_shape = tf.Print(tf.shape(edges_0), [tf.shape(edges_0)]) tf.summary.tensor_summary('shape_edges_0', edges_0_shape)
During the operation of the main program, it is printed as follows: