InvalidArgumentError (see above for traceback): tags and values not the same shape

I'm using Tensorflow 1.13 and trying to create a custom metric for the segmentation task and to show on tensorboard, but I get a weird error. Here is my code

# ...
value = tf.reduce_mean(pred * ground_truth, axis=(1, 2))
tf.summary.scalar('loss value', value)
 InvalidArgumentError (see above for traceback): tags and values not the same shape
tensorflowtensorboard
3 votesLP193.00
1 Answers
JO222.00
1

It's because of the shape of the value. Your "value" variable is a list, not a scalar value. Tensorflow summary scalar requires scalar values. You need to make this

# ...
value = tf.reduce_mean(pred * ground_truth, axis=(1, 2))
tf.summary.scalar('loss value', tf.reduce_mean(value))
Reply
Couldn't find what you were looking for?and we will find an expert to answer.
How helpful was this page?