models/tutorials/rnn/ptb在R1.4第271行失败,没有属性RNNParamsSaveab

2024-10-01 17:21:23 发布

您现在位置:Python中文网/ 问答频道 /正文

API共同出资.RNNParamsSaveable在r1.4中已被弃用,但在tensorflow教程https://www.tensorflow.org/tutorials/recurrent中使用。如何修改ptb\u word中的271->;276行还不完全清楚_lm.py公司使用新的API共同出资.cudnnlstmsavable用于默认运行。有人能告诉我什么需要改变吗?你知道吗


Tags: pyhttpsorggtapitensorflowwww公司
1条回答
网友
1楼 · 发布于 2024-10-01 17:21:23

我将代码更改如下,然后它就可以工作了:

if self._cell and rnn_params:
    params_saveable = tf.contrib.cudnn_rnn.CudnnLSTMSaveable(
        rnn_params,
        self._cell.num_layers,
        self._cell.num_units,
        self._cell.input_size,
        self._cell.input_mode,
        self._cell.direction,
        scope="Model/RNN")

“删除此行”tf.add\到\集合(tf.GraphKeys.SAVEABLE\u对象,参数“可保存”)

相关问题 更多 >

    热门问题