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:
Similar Posts:
- [Solved] PyTorch error: TypeError: ‘builtin_function_or_method‘ object is unsubscriptable
- Weighted cross entropy loss function: tf.nn.weighted_cross_entropy_with_logits
- [Solved] Tensorflow Error: ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type numpy.ndarray)
- InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor ‘…
- attributeError: ‘NoneType’ object has no attribute ‘shape’
- Keras.utils.to in keras_ Categorical method
- tf.nn.top_k(input, k, name=None) & tf.nn.in_top_k(predictions, targets, k, name=None)
- Tensorflow error due to uninitialized variable [How to Fix]
- The Usage of Numpy.unravel_index() function
- How to optimize for inference a simple, saved TensorFlow 1.0.1 graph?