Reputation: 377
I use concat to get tensors as the input of CNN. But got the error: List of Tensors when single Tensor expected
image_raw = img.tobytes()
image = tf.decode_raw(image_raw, tf.uint8)
image = tf.reshape(image, [1, image_height, image_width, 3])
image_val = image
for i in range(batch_size-1):
image_val = tf.concat(0,[image_val,image])
return image_val
I have searched the answers for these question, add
image_val = tf.stack([image_val],0)
before return, but still get the same error ,why?
**build environment:**
TensorFlow version 0.12
python 3.5
Upvotes: 1
Views: 2893
Reputation: 106
Maybe check again the type of image_height, image_width
because sometimes it is necessary to cast these into an integer dtype, e.g. tf.cast(image_height, tf.int32)
Upvotes: 0
Reputation: 83177
The error List of Tensors when single Tensor expected
comes from the fact you wrote tf.concat(0,[image_val,image])
instead of tf.concat([image_val,image],0)
.
Upvotes: 0