class_docstr: Sequence Generator Model.
  
  A deep neural network model for generating sequences.
  
  Arguments:
      network: `Tensor`. Neural network to be used.
      dictionary: `dict`. A dictionary associating each sample with a key (
          usually integers). For example: {'a': 0, 'b': 1, 'c': 2, ...}.
      seq_maxlen: `int`. The maximum length of a sequence.
      tensorboard_verbose: `int`. Summary verbose level, it accepts
          different levels of tensorboard logs:
          ```python
          0 - Loss, Accuracy (Best Speed).
          1 - Loss, Accuracy, Gradients.
          2 - Loss, Accuracy, Gradients, Weights.
          3 - Loss, Accuracy, Gradients, Weights, Activations, Sparsity.
              (Best visualization)
          ```
      tensorboard_dir: `str`. Directory to store tensorboard logs.
          Default: "/tmp/tflearn_logs/"
      checkpoint_path: `str`. Path to store model checkpoints. If None,
          no model checkpoint will be saved. Default: None.
      max_checkpoints: `int` or None. Maximum amount of checkpoints. If
          None, no limit. Default: None.
      session: `Session`. A session for running ops. If None, a new one will
          be created. Note: When providing a session, variables must have been
          initialized already, otherwise an error will be raised.
  
  Attributes:
      trainer: `Trainer`. Handle model training.
      predictor: `Predictor`. Handle model prediction.
      session: `Session`. The current model session.
class_docstr_tok: ["Sequence","Generator","Model",".","A","deep","neural","network","model","for","generating","sequences",".","Arguments",":","network",":","`","Tensor","`",".","Neural","network","to","be","used",".","dictionary",":","`","dict","`",".","A","dictionary","associating","each","sample","with","a","key","(","usually","integers",")",".","For","example",":","{","'","a","'",":","0",",","'","b","'",":","1",",","'","c","'",":","2",",","...","}",".","seq_maxlen",":","`","int","`",".","The","maximum","length","of","a","sequence",".","tensorboard_verbose",":","`","int","`",".","Summary","verbose","level",",","it","accepts","different","levels","of","tensorboard","logs",":","``","`","python","0","-","Loss",",","Accuracy","(","Best","Speed",")",".","1","-","Loss",",","Accuracy",",","Gradients",".","2","-","Loss",",","Accuracy",",","Gradients",",","Weights",".","3","-","Loss",",","Accuracy",",","Gradients",",","Weights",",","Activations",",","Sparsity",".","(","Best","visualization",")","``","`","tensorboard_dir",":","`","str","`",".","Directory","to","store","tensorboard","logs",".","Default",":","``","\/tmp\/tflearn_logs\/","''","checkpoint_path",":","`","str","`",".","Path","to","store","model","checkpoints",".","If","None",",","no","model","checkpoint","will","be","saved",".","Default",":","None",".","max_checkpoints",":","`","int","`","or","None",".","Maximum","amount","of","checkpoints",".","If","None",",","no","limit",".","Default",":","None",".","session",":","`","Session","`",".","A","session","for","running","ops",".","If","None",",","a","new","one","will","be","created",".","Note",":","When","providing","a","session",",","variables","must","have","been","initialized","already",",","otherwise","an","error","will","be","raised",".","Attributes",":","trainer",":","`","Trainer","`",".","Handle","model","training",".","predictor",":","`","Predictor","`",".","Handle","model","prediction",".","session",":","`","Session","`",".","The","current","model","session","."]
docstr: Generate.
  
  Generate a sequence. Temperature is controlling the novelty of
  the created sequence, a temperature near 0 will looks like samples
  used for training, while the higher the temperature, the more novelty.
  For optimal results, it is suggested to set sequence seed as some
  random sequence samples from training dataset.
  
  Arguments:
      seq_length: `int`. The generated sequence length.
      temperature: `float`. Novelty rate.
      seq_seed: `sequence`. A sequence used as a seed to generate a
          new sequence. Suggested to be a sequence from data used for
          training.
      display: `bool`. If True, print sequence as it is generated.
  
  Returns:
      The generated sequence.
docstr_tok: ["Generate",".","Generate","a","sequence",".","Temperature","is","controlling","the","novelty","of","the","created","sequence",",","a","temperature","near","0","will","looks","like","samples","used","for","training",",","while","the","higher","the","temperature",",","the","more","novelty",".","For","optimal","results",",","it","is","suggested","to","set","sequence","seed","as","some","random","sequence","samples","from","training","dataset",".","Arguments",":","seq_length",":","`","int","`",".","The","generated","sequence","length",".","temperature",":","`","float","`",".","Novelty","rate",".","seq_seed",":","`","sequence","`",".","A","sequence","used","as","a","seed","to","generate","a","new","sequence",".","Suggested","to","be","a","sequence","from","data","used","for","training",".","display",":","`","bool","`",".","If","True",",","print","sequence","as","it","is","generated",".","Returns",":","The","generated","sequence","."]
code: def generate(
      self, seq_length, temperature=0.5, seq_seed=None, display=False
  ):
      """Generate.
  
      Generate a sequence. Temperature is controlling the novelty of
      the created sequence, a temperature near 0 will looks like samples
      used for training, while the higher the temperature, the more novelty.
      For optimal results, it is suggested to set sequence seed as some
      random sequence samples from training dataset.
  
      Arguments:
          seq_length: `int`. The generated sequence length.
          temperature: `float`. Novelty rate.
          seq_seed: `sequence`. A sequence used as a seed to generate a
              new sequence. Suggested to be a sequence from data used for
              training.
          display: `bool`. If True, print sequence as it is generated.
  
      Returns:
          The generated sequence.
  
      """
  
      generated = seq_seed[:]
      sequence = seq_seed[:]
      whole_sequence = seq_seed[:]
  
      if display:
          sys.stdout.write(str(generated))
  
      for i in range(seq_length):
          x = np.zeros((1, self.seq_maxlen, len(self.dic)))
          for t, char in enumerate(sequence):
              x[0, t, self.dic[char]] = 1.0
  
          preds = self._predict(x)[0].tolist()
          next_index = _sample(preds, temperature)
          next_char = self.rev_dic[next_index]
  
          try:  # Python 2
              unicode_or_str = [str, unicode]
          except:  # Python 3
              unicode_or_str = [str]
          if type(sequence) in unicode_or_str:
              generated += next_char
              sequence = sequence[1:] + next_char
              whole_sequence += next_char
          else:
              generated.append(next_char)
              sequence = sequence[1:]
              sequence.append(next_char)
              whole_sequence.append(next_char)
  
          if display:
              sys.stdout.write(str(next_char))
              sys.stdout.flush()
  
      if display:
          print()
  
      return whole_sequence
  
file_path: tflearn/tflearn/models/generator.py
imports: from __future__ import division, print_function, absolute_import
  import sys
  import numpy
  import tensorflow.compat.v1
  from ..helpers.trainer import Trainer, evaluate
  from ..helpers.evaluator import Evaluator
  from ..utils import feed_dict_builder, is_none
label_desc: Use image node_id 4 for calling the SequenceGenerator obj's underlying member method code with example usage: obj.generate(seq_length, temperature, seq_seed, display) and returns: whole_sequence