0
 builtins.ValueError: Dimension 0 in both shapes must be equal,
 but are 13 and 14 for 'concat' (op: 'ConcatV2') with input shapes:   
 [4,13,17,512], [4,14,18,512], [] and with computed 
 input tensors: input[2] = <0>.

as you see,concat2 = tf.concat([conv5_1, deconv5], axis = 0)leads to above error, I have no idea about how to solve it, anyone help?Thanks a lot!

chuchienshu
  • 45
  • 1
  • 1
  • 11
  • [TensorFlow - Pad unknown size tensor to a specific size?](https://stackoverflow.com/q/42334646/6521116) – LF00 Jul 13 '17 at 14:35

1 Answers1

0

Your tensors must be the same size in order to concatenate them, which is why you are getting this are.

There are a few options to make the tensors the same size, but make sure they make sense with the data you are using and aren't causing you loss of informations:

  1. Reshape one tensor to the size of the other using tf.image.resize_images

  2. Zero pad both tensors with tf.pad so that they're the same size. This is risky since when you concatenate them certain stacked values may not represent the same information.

  3. Finally, you can crop the larger tensor to the dimensions of the smaller one using tf.image.crop_to_bounding_box. This is again maybe not a good idea with your case because your tensor dimensions are off by a value of 1 so you wouldn't be centrally cropping.
bnorm
  • 399
  • 2
  • 16