code: def test_train_predict2():
      """
      Test that the embedding_attention model works, with saving and loading of weights
      """
      import tempfile
  
      sp = SequencePattern()
      tempdir = tempfile.mkdtemp()
      ts2s = TFLearnSeq2Seq(
          sp,
          seq2seq_model="embedding_attention",
          data_dir=tempdir,
          name="attention",
      )
      tf.reset_default_graph()
      ts2s.train(
          num_epochs=1,
          num_points=1000,
          weights_output_fn=1,
          weights_input_fn=0,
      )
      assert os.path.exists(ts2s.weights_output_fn)
  
      tf.reset_default_graph()
      ts2s = TFLearnSeq2Seq(
          sp,
          seq2seq_model="embedding_attention",
          data_dir="DATA",
          name="attention",
          verbose=1,
      )
      prediction, y = ts2s.predict(Xin=range(10), weights_input_fn=1)
      assert len(prediction == 10)
  
      os.system("rm -rf %s" % tempdir)
  
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 6 for calling a global function with example usage: test_train_predict2() without return types