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(range(10))
      s = dc.models.SeqToSeq(
          tokens,
          tokens,
          sequence_length,
          encoder_layers=2,
          decoder_layers=2,
          embedding_dimension=128,
          learning_rate=0.01,
          variational=True,
      )
  
      # Actually training a VAE takes far too long for a unit test.  Just run a
      # few steps of training to make sure nothing crashes, then check that the
      # results are at least internally consistent.
  
      s.fit_sequences(generate_sequences(sequence_length, 1000))
      for sequence, target in generate_sequences(sequence_length, 10):
          pred1 = s.predict_from_sequences([sequence], beam_width=1)
          embedding = s.predict_embeddings([sequence])
          assert pred1 == s.predict_from_embeddings(
              embedding, beam_width=1
          )
  
file_path: deepchem/deepchem/models/tests/test_seqtoseq.py
imports: import pytest
  import deepchem
  import numpy
  import unittest
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