title: Tensorflow classification to regression "Assign requires shapes of both tensors to match"
body: <p>I'm trying to convert the below classification graph to regression instead so that instead of 3 values it returns just one value -</p>
  
  <pre><code>baseFeatureSize = 5
  keep_prob = tf.placeholder(tf.float32)
  x = tf.placeholder(tf.float32, shape=[None, 64])
  x_image = tf.reshape(x, [-1, 8, 8, 1])
  W_conv1 = weight_variable([5, 5, 1, baseFeatureSize])
  b_conv1 = bias_variable([baseFeatureSize])
  h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1)
  W_conv2 = weight_variable([8, 8, baseFeatureSize, baseFeatureSize * 2])
  b_conv2 = bias_variable([baseFeatureSize * 2])
  h_conv2 = tf.nn.relu(conv2d(h_conv1, W_conv2) + b_conv2)
  W_fc1 = weight_variable([8 * 8 * baseFeatureSize * 2, baseFeatureSize * 4])
  b_fc1 = bias_variable([baseFeatureSize * 4])
  h_pool2_flat = tf.reshape(h_conv2, [-1, 8 * 8 * baseFeatureSize * 2])
  h_fc1 = tf.nn.relu(tf.matmul(h_pool2_flat, W_fc1) + b_fc1)
  h_fc1_drop = tf.nn.dropout(h_fc1, keep_prob)
  
  W_fc3 = weight_variable([baseFeatureSize * 4, 3])
  b_fc3 = bias_variable([3])
  y_policy = tf.placeholder(tf.float32, shape=[None, 3])
  y_policy_conv = tf.matmul(h_fc1, W_fc3) + b_fc3
  cross_entropy_policy = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(labels=y_policy, logits=y_policy_conv))
  train_step_policy = tf.train.AdamOptimizer(learning_rate = 0.01).minimize(cross_entropy_policy)
  </code></pre>
  
  <p>For it to work as regression, I've changed the fully connected parts - W_fc3, b_fc3, outputs, cross entropy and train_step to have tensor shape dimension of 1 instead of 3 as below (rest of the graph stays the same) -</p>
  
  <pre><code>W_fc3 = weight_variable([baseFeatureSize * 4, 1])
  b_fc3 = bias_variable([1])
  y_policy = tf.placeholder(tf.float32, shape=[None, 1])
  y_policy_conv = tf.nn.softmax(tf.matmul(h_fc1, W_fc3) + b_fc3)
  cross_entropy_policy = tf.reduce_mean(-tf.reduce_sum(y_policy * tf.log(y_policy_conv), reduction_indices=1))
  train_step_policy = tf.train.GradientDescentOptimizer(0.01).minimize(cross_entropy_policy)
  </code></pre>
  
  <p>But it keeps throwing the below error -</p>
  
  <blockquote>
    <p>InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [1] rhs shape= [3]</p>
  </blockquote>
  
  <p>I can't see a 3 anywhere. What could be wrong?</p>