import tensorflow as tf

          average_across_batch=True)
      res = sess.run(average_loss_per_sequence)
      self.assertAllClose(4.828314, res)

      total_loss = tf.nn.seq2seq.sequence_loss(
          logits, targets, weights,
          average_across_timesteps=False,
          average_across_batch=False)
