title: Tensorflow dataset.batch() not showing the real batch size
body: <p>I would like to change the original queue based data load mechanism to <code>tf.data</code> API.</p>
  
  <p>The original code is:</p>
  
  <pre><code>    # Index queue
      self.input_idxs = tf.placeholder(tf.int64, shape=[None, 2])
      idx_queue = tf.FIFOQueue(1e8, tf.int64)
      self.enq_idxs = idx_queue.enqueue_many(self.input_idxs)
      get_idx = idx_queue.dequeue()
  
      # Image loading queue
      img_queue = tf.FIFOQueue(opt.max_queue_size, task.proc_arg_dtype)
      load_data = tf.py_func(task.load_sample_data, [get_idx], task.proc_arg_dtype)
      enq_img = img_queue.enqueue(load_data)
      init_sample = img_queue.dequeue()
  
      # Preprocessing queue
      # (for any preprocessing that can be done with TF operations)
      data_queue = tf.FIFOQueue(opt.max_queue_size, task.data_arg_dtype,
                                shapes=task.data_shape)
      enq_data = data_queue.enqueue(task.preprocess(init_sample, train_flag))
      self.get_sample = data_queue.dequeue_many(opt.batchsize)
  </code></pre>
  
  <p>After the change, it is:</p>
  
  <pre><code>    # Dataset
      self.input_idxs = tf.placeholder(tf.int64, shape=[None, 2])
      dataset = tf.data.Dataset.from_tensor_slices(self.input_idxs)
  
      def load_sample(idx):
          sample = task.load_sample_data(idx)
          sample = task.preprocess(sample, train_flag)
          return sample
  
      dataset = dataset.map(lambda idx: tf.py_func(load_sample, [idx], task.proc_arg_dtype), num_parallel_calls=self.num_threads)
  
      def gen(dataset):
          yield dataset.make_one_shot_iterator().get_next()
  
      dataset = tf.data.Dataset.from_generator(gen, tuple(task.proc_arg_dtype), tuple(task.data_shape))
      dataset = dataset.batch(opt.batchsize)
      self.iterator = dataset.make_initializable_iterator()
      self.get_sample = self.iterator.get_next()
  </code></pre>
  
  <p>where <code>task.proc_arg_dtype</code> and <code>task.data_shape</code> are:</p>
  
  <pre><code>    proc_arg_dtype = [tf.float32, tf.float32, tf.int32, tf.int32, tf.int32, tf.float32, tf.int32, tf.int32, tf.int32]
      data_shape = [
          [opt.input_res, opt.input_res, 3],
          [opt.output_res, opt.output_res, opt.det_inputs],
          [2, opt.max_nodes, 2],
          [4],
          [opt.max_nodes, opt.obj_slots + opt.rel_slots],
          [opt.max_nodes, opt.obj_slots, 5],
          [opt.max_nodes, opt.rel_slots, 2],
          [opt.max_nodes, 7],
          [1]
      ]
  </code></pre>
  
  <p>Since I find <code>tf.py_func</code> doesn't have <code>data_shape</code> argument so that I use the <code>tf.data.Dataset.from_generator</code> to do it. (Not sure whether it is correct since I met an issue before running compete)</p>
  
  <p>The question is previously the <code>self.get_sample</code> is similar to:</p>
  
  <pre><code>[&lt;tf.Tensor 'IteratorGetNext:0' shape=(8, 512, 512, 3) dtype=float32&gt;, &lt;tf.Tensor 'IteratorGetNext:1' shape=(8, 64, 64, 300) dtype=float32&gt;, &lt;tf.Tensor 'IteratorGetNext:2' shape=(8, 2, 200, 2) dtype=int32&gt;, &lt;tf.Tensor 'IteratorGetNext:3' shape=(8, 4) dtype=int32&gt;, &lt;tf.Tensor 'IteratorGetNext:4' shape=(8, 200, 9) dtype=int32&gt;, &lt;tf.Tensor 'IteratorGetNext:5' shape=(8, 200, 3, 5) dtype=float32&gt;, &lt;tf.Tensor 'IteratorGetNext:6' shape=(8, 200, 6, 2) dtype=int32&gt;, &lt;tf.Tensor 'IteratorGetNext:7' shape=(8, 200, 7) dtype=int32&gt;, &lt;tf.Tensor 'IteratorGetNext:8' shape=(8, 1) dtype=int32&gt;]
  </code></pre>
  
  <p>Where the batch size is the first dimension. However by using <code>dataset.batch(opt.batch_size)</code>, the <code>self.get_sample</code> is </p>
  
  <pre><code>[&lt;tf.Tensor 'IteratorGetNext:0' shape=(?, 512, 512, 3) dtype=float32&gt;, &lt;tf.Tensor 'IteratorGetNext:1' shape=(?, 64, 64, 300) dtype=float32&gt;, &lt;tf.Tensor 'IteratorGetNext:2' shape=(?, 2, 200, 2) dtype=int32&gt;, &lt;tf.Tensor 'IteratorGetNext:3' shape=(?, 4) dtype=int32&gt;, &lt;tf.Tensor 'IteratorGetNext:4' shape=(?, 200, 9) dtype=int32&gt;, &lt;tf.Tensor 'IteratorGetNext:5' shape=(?, 200, 3, 5) dtype=float32&gt;, &lt;tf.Tensor 'IteratorGetNext:6' shape=(?, 200, 6, 2) dtype=int32&gt;, &lt;tf.Tensor 'IteratorGetNext:7' shape=(?, 200, 7) dtype=int32&gt;, &lt;tf.Tensor 'IteratorGetNext:8' shape=(?, 1) dtype=int32&gt;]
  </code></pre>
  
  <p>Which not shows the real batch size.</p>