title: How to define a scalar placeholder with known shape in Tensorflow
body: <p>I'm trying to define a scalar placeholder like:</p>
  
  <pre><code>alpha = tf.placeholder(tf.float32,shape=(),name='alpha')
  </code></pre>
  
  <p>The problem is that its shape is <code>&lt;unknown&gt;</code>:</p>
  
  <pre><code>print(alpha.get_shape())
  &lt;unknown&gt;
  </code></pre>
  
  <p>When <code>alpha</code> is multiplied by another tensor, its output shape is also <code>&lt;unknown&gt;</code>:</p>
  
  <pre><code>x = tf.placeholder(tf.float32,shape=[None,128,128,3],name='x')
  I = alpha * x
  print(I.get_shape())
  &lt;unknown&gt;
  </code></pre>
  
  <p>This creates a problem since <code>I</code> is feed into a convolution operation which uses <code>fan_in = k_h * k_w * input_.get_shape().as_list()[-1]</code> where <code>input_</code> is <code>I</code>. As a result following error pops up:</p>
  
  <pre><code>TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'
  </code></pre>
  
  <p>I'm looking for a neat way to solve this problem. Preferably, defining a scalar placeholder with a known shape.</p>