class_docstr: seq2seq recurrent neural network, implemented using TFLearn.
class_docstr_tok: ["seq2seq","recurrent","neural","network",",","implemented","using","TFLearn","."]
docstr: Loss function for the seq2seq RNN.  Reshape predicted and true (label) tensors, generate dummy weights,
  then use seq2seq.sequence_loss to actually compute the loss function.
docstr_tok: ["Loss","function","for","the","seq2seq","RNN",".","Reshape","predicted","and","true","(","label",")","tensors",",","generate","dummy","weights",",","then","use","seq2seq.sequence_loss","to","actually","compute","the","loss","function","."]
code: def sequence_loss(self, y_pred, y_true):
      """
      Loss function for the seq2seq RNN.  Reshape predicted and true (label) tensors, generate dummy weights,
      then use seq2seq.sequence_loss to actually compute the loss function.
      """
      if self.verbose > 2:
          print(
              "my_sequence_loss y_pred=%s, y_true=%s" % (y_pred, y_true)
          )
      logits = tf.unstack(
          y_pred, axis=1
      )  # list of [-1, num_decoder_synbols] elements
      targets = tf.unstack(
          y_true, axis=1
      )  # y_true has shape [-1, self.out_seq_len]; unpack to list of self.out_seq_len [-1] elements
      if self.verbose > 2:
          print("my_sequence_loss logits=%s" % (logits,))
          print("my_sequence_loss targets=%s" % (targets,))
      weights = [tf.ones_like(yp, dtype=tf.float32) for yp in targets]
      if self.verbose > 4:
          print("my_sequence_loss weights=%s" % (weights,))
      sl = seq2seq.sequence_loss(logits, targets, weights)
      if self.verbose > 2:
          print("my_sequence_loss return = %s" % sl)
      return sl
  
imports: from __future__ import division, print_function
  import os
  import sys
  import tflearn
  import argparse
  import json
  import numpy
  import tensorflow.compat.v1
  from tensorflow.contrib.legacy_seq2seq.python.ops import seq2seq
  from tensorflow.python.ops import rnn_cell
label_desc: Use image node_id 3 for calling the TFLearnSeq2Seq obj's underlying member method code with example usage: obj.sequence_loss(y_pred, y_true) and returns: sl