class_docstr: Base class for seq2seq models with embeddings
    
docstr: Computes the loss for this model.
  
  Returns a tuple `(losses, loss)`, where `losses` are the per-batch
  losses and loss is a single scalar tensor to minimize.
docstr_tok: ["Computes","the","loss","for","this","model",".","Returns","a","tuple","`","(","losses",",","loss",")","`",",","where","`","losses","`","are","the","per-batch","losses","and","loss","is","a","single","scalar","tensor","to","minimize","."]
code: def compute_loss(self, decoder_output, _features, labels):
      """Computes the loss for this model.
  
      Returns a tuple `(losses, loss)`, where `losses` are the per-batch
      losses and loss is a single scalar tensor to minimize.
      """
      # pylint: disable=R0201
      # Calculate loss per example-timestep of shape [B, T]
      losses = seq2seq_losses.cross_entropy_sequence_loss(
          logits=decoder_output.logits[:, :, :],
          targets=tf.transpose(labels["target_ids"][:, 1:], [1, 0]),
          sequence_length=labels["target_len"] - 1,
      )
  
      # Calculate the average log perplexity
      loss = tf.reduce_sum(losses) / tf.to_float(
          tf.reduce_sum(labels["target_len"] - 1)
      )
  
      return losses, loss
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import collections
  import tensorflow
  from seq2seq import graph_utils
  from seq2seq import losses
  from seq2seq.contrib.seq2seq.decoder import _transpose_batch_time
  from seq2seq.data import vocab
  from seq2seq.graph_utils import templatemethod
  from seq2seq.decoders.beam_search_decoder import BeamSearchDecoder
  from seq2seq.inference import beam_search
  from seq2seq.models.model_base import ModelBase, _flatten_dict
label_desc: Use image node_id 13 for calling the Seq2SeqModel obj's underlying member method code with example usage: obj.compute_loss(decoder_output, _features, labels) and returns: losses,  loss