title: How to map Iterator's output to placeholder in loss function in Tensorflow using Dataset API
body: <p>Below is the code from tensorflow website regarding using the dataset api for consuming data from tfrecords</p>
  
  <pre><code>filenames = ["/var/data/file1.tfrecord", "/var/data/file2.tfrecord"]
  dataset = tf.contrib.data.TFRecordDataset(filenames)
  dataset = dataset.map(...)
  dataset = dataset.shuffle(buffer_size=10000)
  dataset = dataset.batch(32)
  dataset = dataset.repeat(num_epochs)
  
  iterator = dataset.make_one_shot_iterator()
  next_example, next_label = iterator.get_next()
  
  loss = model_function(next_example, next_label)
  training_op = tf.train.AdagradOptimizer(...).minimize(loss)
  
  with tf.train.MonitoredTrainingSession(...) as sess:
    while not sess.should_stop
  </code></pre>
  
  <p>Normally I define my network as </p>
  
  <pre><code>x = tf.placeholder(tf.float32, [None, INPUT_SIZE], name='INPUT')
  y_ = tf.placeholder(tf.float32, [None, OUTPUT_SIZE], name='OUTPUT')
  
  w1 = tf.Variable(tf.truncated_normal([INPUT_SIZE, L1_SIZE], stddev=0.1))
  b1 = tf.Variable(tf.constant(0.1, shape=[L1_SIZE]))
  w2 = tf.Variable(tf.truncated_normal([L1_SIZE, L2_SIZE], stddev=0.1))
  b2 = tf.Variable(tf.constant(0.1, shape=[L2_SIZE]))
  
  w3 = tf.Variable(tf.truncated_normal([L2_SIZE, OUTPUT_SIZE], stddev=0.1))
  b3 = tf.Variable(tf.constant(0.1, shape=[OUTPUT_SIZE]))
  
  input_layer = tf.nn.relu(tf.matmul(x, w1) + b1)
  hidden_layer1_dropout = tf.nn.dropout(input_layer, DROPOUT1)
  
  hidden_layer2 = tf.nn.relu(tf.matmul(hidden_layer1_dropout, w2) + b2)
  hidden_layer2_dropout = tf.nn.dropout(hidden_layer2, DROPOUT2)
  
  y = tf.nn.softmax(tf.matmul(hidden_layer2_dropout, w3) + b3)
  </code></pre>
  
  <p>and my loss function as</p>
  
  <pre><code>cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y), reduction_indices=[1]))
  </code></pre>
  
  <p>But now looks like it is not necessary to use feed_dict any more, but I'm quite confused about how to define the loss function in this new way, the sample code only show a single line</p>
  
  <pre><code>loss = model_function(next_example, next_label)
  </code></pre>
  
  <p>Can anyone help to give a detail example how to define the loss function, how to map the features and label to the placeholders? Thanks a lot</p>