python - Shape of a new variable must be fully defined, but instead was (?, 128) -


i training multi layer convolution network using tensorflow.i had no issues 2 layers.for third layer,when define weight,it gives me error shape of new variable must defined, instead (?, 128). saw sof link , used reuse=true, error persists.any helpful.

below code:

with tf.variable_scope('local3') scope:     reshape = tf.reshape(pool2, shape=[batch_size, -1])     dim = reshape.get_shape()[1].value     weights = tf.get_variable('weights',                               shape=[dim,128],                               dtype=tf.float32,                               initializer=tf.truncated_normal_initializer(stddev=0.005,dtype=tf.float32))     biases = tf.get_variable('biases',                              shape=[128],                              dtype=tf.float32,                               initializer=tf.constant_initializer(0.1))     local3 = tf.nn.relu(tf.matmul(reshape, weights) + biases, name=scope.name)     

here batch_size 32 , pool2 tensor of shape=(?, 14, 14, 16).

note:this code works when execute inside function.why so?


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -