title: Tensorflow variable batch size, variable reshape and weights
body: <p>I'm trying to build a graph with variable batch size, variable reshape and variable weight shape. I'm using tensorflow 1.3.0.</p>
  
  <p>Using the code below, <strong>tf.get_variable</strong> throws a <strong>TypeError: int() argument must be a string or a number, not 'Tensor'</strong>. <strong>pool2</strong> is defined somewhere else in the code.</p>
  
  <pre><code># declare placeholder for variable batch size
  images_ph = tf.placeholder(tf.float32, shape=[None, 64, 64, 1])
  # code for 2 layers of convolution, normalization and max pooling
  # reshape to perform, one matrix multiply
  reshape = tf.reshape(pool2, [tf.shape(images_ph)[0], -1])
  dim = tf.shape(reshape)[1]
  var = tf.get_variable('name', [dim, 384], validate_shape=False)
  </code></pre>
  
  <p>I have also tried to substitute <strong>dim</strong> to have the 'correct' type as follows:</p>
  
  <pre><code>dim = reshape.get_shape()[1]
  </code></pre>
  
  <p><strong>dim</strong> is equal to <strong>None</strong> and throws a <strong>ValueError: Shape of a new variable (local3/xpto) must be fully defined, but instead was (?, 384).</strong></p>