TensorFlow 1.2 How to Setup Time Series Prediction at Inference Time Using Seq2Seq

后端 未结 1 759
一个人的身影
一个人的身影 2021-02-04 22:14

I am trying to study the tf.contrib.seq2seq section of the TensorFlow library using a toy model. Currently, my graph is as follows:

tf.reset_default_graph()

#          


        
相关标签:
1条回答
  • 2021-02-04 22:49

    You are right that you need to use another helper function for inference, but you need to share weights between testing and inference.

    You can do this with tf.variable_scope()

    with tf.variable_scope("decode"):
        training_helper = ...
    
    with tf.variable_scope("decode", reuse = True):
        inference_helper = ...
    

    For a more complete example, see one of these two examples:

    • https://github.com/pplantinga/tensorflow-examples/blob/master/TensorFlow%201.2%20seq2seq%20example.ipynb
    • https://github.com/udacity/deep-learning/blob/master/seq2seq/sequence_to_sequence_implementation.ipynb
    0 讨论(0)
提交回复
热议问题