I am following this tutorial for learning TensorFlow Slim but upon running the following code for Inception:
import numpy as np
import os
import tensorflow a
I got same error when I did the work.
I found that
logits = tf.nn.xw_plus_b(tf.concat(outputs, 0), w, b)
loss = tf.reduce_mean(
tf.nn.softmax_cross_entropy_with_logits(
labels=tf.concat(train_labels, 0), logits=logits))
The output is shape=(10, 64, 64)
.
The code want concat outputs[0] to outputs[9] => get a new shape(640,64).
But the "tf.concat" API may not allow to do this.
(train_labels same to this)
So I write to
A = tf.concat(0,[outputs[0],outputs[1]])
A = tf.concat(0,[A,outputs[2]])
A = tf.concat(0,[A,outputs[3]])
A = tf.concat(0,[A,outputs[4]])
A = tf.concat(0,[A,outputs[5]])
A = tf.concat(0,[A,outputs[6]])
A = tf.concat(0,[A,outputs[7]])
A = tf.concat(0,[A,outputs[8]])
A = tf.concat(0,[A,outputs[9]])
B = tf.concat(0,[train_labels[0],train_labels[1]])
B = tf.concat(0,[B,train_labels[2]])
B = tf.concat(0,[B,train_labels[3]])
B = tf.concat(0,[B,train_labels[4]])
B = tf.concat(0,[B,train_labels[5]])
B = tf.concat(0,[B,train_labels[6]])
B = tf.concat(0,[B,train_labels[7]])
B = tf.concat(0,[B,train_labels[8]])
B = tf.concat(0,[B,train_labels[9]])
logits = tf.nn.xw_plus_b(tf.concat(0, A), w, b)
loss = tf.reduce_mean(
tf.nn.softmax_cross_entropy_with_logits(
labels=tf.concat(0, B), logits=logits))
It can run!