title: Tensorflow - softmax with data of different sizes
body: <p>I am building a neural network model with data matrix of same number of columns(features) but varying number of rows, and hence varying size of training labels. I am using cross entropy with logit as the loss function.</p>
  
  <p>For example, I have data like this:</p>
  
  <pre><code>data1 = np.array([[0.1,0.2,0.3],[0.2,0.3,0.4],[0.3,0.4,0.5]])
  data2 = np.array([[0.2,0.3,0.4],[0.3,0.4,0.5]])
  label_1 = np.array([0,0,1])
  label_2 = np.array([1,0])
  </code></pre>
  
  <p>so we have a weight vector of dimension (3x1) and a bias b, and our loss function is:</p>
  
  <pre><code>loss = -1*(log(label_1*softmax(data1*weight+b)) + log(label_2*softmax(data2*weight+b)))
  </code></pre>
  
  <p>In Tensorflow, I know I can define a placeholder with None dimension like:</p>
  
  <pre><code>tf_data = tf.placeholder(tf.float32, shape=(batch_size, None, feature_size))
  tf_labels = tf.placeholder(tf.float32, shape=(batch_size, None))
  </code></pre>
  
  <p>My question is, how can I feed the data to <code>feed_dict</code>? Since <code>data = np.array([data1,data2])</code> returns a numpy array storing two numpy arrays and result in:</p>
  
  <pre><code>ValueError: setting an array element with a sequence
  </code></pre>
  
  <p>Also, what tensorflow function I can use to compute <code>data*weight? tf.matmul(data,weight)</code> result in Shape must be rank 2 but is rank 3 for 'MatMul'</p>