docstr: Test learning to reproduce short sequences of integers.
docstr_tok: ["Test","learning","to","reproduce","short","sequences","of","integers","."]
code: def test_int_sequence(self):
      """Test learning to reproduce short sequences of integers."""
  
      sequence_length = 8
      tokens = list(range(10))
      s = dc.models.SeqToSeq(
          tokens,
          tokens,
          sequence_length,
          encoder_layers=2,
          decoder_layers=2,
          embedding_dimension=150,
          learning_rate=0.01,
          dropout=0.1,
      )
  
      # Train the model on random sequences.  We aren't training long enough to
      # really make it reliable, but I want to keep this test fast, and it should
      # still be able to reproduce a reasonable fraction of input sequences.
  
      s.fit_sequences(generate_sequences(sequence_length, 25000))
  
      # Test it out.
  
      tests = [
          seq for seq, target in generate_sequences(sequence_length, 50)
      ]
      pred1 = s.predict_from_sequences(tests, beam_width=1)
      pred4 = s.predict_from_sequences(tests, beam_width=4)
      embeddings = s.predict_embeddings(tests)
      pred1e = s.predict_from_embeddings(embeddings, beam_width=1)
      pred4e = s.predict_from_embeddings(embeddings, beam_width=4)
      count1 = 0
      count4 = 0
      for i in range(len(tests)):
          if pred1[i] == tests[i]:
              count1 += 1
          if pred4[i] == tests[i]:
              count4 += 1
          assert pred1[i] == pred1e[i]
          assert pred4[i] == pred4e[i]
  
      # Check that it got at least a quarter of them correct.
  
      assert count1 >= 12
      assert count4 >= 12
  
file_path: deepchem/deepchem/models/tests/test_seqtoseq.py
imports: import pytest
  import deepchem
  import numpy
  import unittest
label_desc: Use image node_id 1 for calling the TestSeqToSeq obj's underlying member method code with example usage: obj.test_int_sequence() without return types