docstr: Test using a SeqToSeq model as a variational autoenconder.
docstr_tok: ["Test","using","a","SeqToSeq","model","as","a","variational","autoenconder","."]
code: def test_variational(self):
      """Test using a SeqToSeq model as a variational autoenconder."""
      sequence_length = 10
      tokens = list(str(x) for x in range(10))
      model = SeqToSeqModel(
          tokens,
          tokens,
          sequence_length,
          encoder_layers=1,
          decoder_layers=1,
          embedding_dimension=128,
          learning_rate=0.01,
          variational=True,
      )
      model.fit_sequences(generate_sequences(sequence_length, 10000))
      count_normal = 0
      count_special = 0
      for sequence, target in generate_sequences(sequence_length, 100):
          pred1 = model.predict_from_sequences([sequence], beam_width=5)
          embedding = model.predict_embedding([sequence])
          pred2 = model.predict_from_embedding(embedding, beam_width=5)
          if "".join(pred1[0]) == sequence:
              count_normal += 1
          if "".join(pred2[0]) == sequence:
              count_special += 1
      assert count_special > count_normal
  
file_path: deepchem/deepchem/models/tests/test_seqtoseq_model.py
imports: import pytest
  import unittest
  from typing import Set
  import tempfile
  import numpy
  from deepchem.utils.batch_utils import create_input_array
label_desc: Use image node_id 3 for calling the TestSeqToSeq obj's underlying member method code with example usage: obj.test_variational() without return types