AttributeError: module 'tensorflow.python.ops.nn' has no attribute 'legacy_seq2s eq'

来源:互联网 发布:传奇盛世翅膀8升9数据 编辑:程序博客网 时间:2024/04/28 13:44
tensorflow 版本改动较大 如
self.lossFct = tf.nn.legacy_seq2seq.sequence_loss
改成了
self.lossFct = tf.nn.seq2seq.sequence_loss

import tensorflow as tfprint(tf.__version__)def _run_rnn(self, inputs):        # embedded inputs are passed in here        self.initial_state = tf.zeros([self._batch_size, self._hidden_size], tf.float32)        cell = tf.nn.rnn_cell.GRUCell(self._hidden_size)        cell = tf.nn.rnn_cell.DropoutWrapper(cell, output_keep_prob=self._dropout_placeholder)        cell = tf.nn.rnn_cell.MultiRNNCell([cell] * self._num_layers, state_is_tuple=False)        outputs, last_state = tf.nn.dynamic_rnn(            cell = cell,            inputs = inputs,            sequence_length = self.sequence_length,            initial_state = self.initial_state        )        return outputs, last_state
阅读全文
0 0
原创粉丝点击