1. 程式人生 > >tf.nn.seq2seq 函式 新版本調整

tf.nn.seq2seq 函式 新版本調整

Tensorflow 函式調整:

tf.nn.seq2seq.sequence_loss_by_example(
            [logits],   # output [batch*numsteps, vocab_size]
            [tf.reshape(self._targets, [-1])],  # target, [batch_size, num_steps]
            [tf.ones([batch_size * num_steps], dtype=data_type())]) # weight

改為:

tf.contrib.legacy_seq2seq.sequence_loss_by_example(
            [logits],   # output [batch*numsteps, vocab_size]
            [tf.reshape(self._targets, [-1])],  # target, [batch_size, num_steps]
            [tf.ones([batch_size * num_steps], dtype=data_type())]) # weight