【问题标题】:Getting the following error, "ImportError: cannot import name 'rnn_cell_impl' " on tensorfow V 1.4.0在 tensorfow V 1.4.0 上出现以下错误“ImportError: cannot import name 'rnn_cell_impl'”
【发布时间】:2018-03-02 20:06:34
【问题描述】:
~/anaconda3/lib/python3.6/site-packages/tflearn/layers/recurrent.py in <module>()
     12     # Fix for TF 1.1.0 and under
     13     from tensorflow.contrib.rnn.python.ops.core_rnn import static_rnn as _rnn, static_bidirectional_rnn as _brnn
---> 14     from tensorflow.python.ops.rnn import rnn_cell_impl as _rnn_cell, dynamic_rnn as _drnn
     15     from tensorflow.contrib.rnn.python.ops import core_rnn_cell
     16 

ImportError: cannot import name 'rnn_cell_impl'

出现以下错误。 TF 1.4 版。

【问题讨论】:

    标签: python tensorflow tflearn


    【解决方案1】:

    也发布您的代码。试试下面的方法,

    from tensorflow.python.ops import rnn_cell_impl
    

    【讨论】:

    • import nltk from nltk.stem.lancaster import LancasterStemmer stemmer = LancasterStemmer() # Tensorflow 需要的东西 import numpy as np import tflearn import tensorflow as tf import random from tensorflow.python.ops import rnn_cell_impl # from tensorflow.contrib.rnn.python.ops.rnn_cell import _Linear #import tensorflow.python.ops.tensor_array_ops
    • 对于上面的代码,我添加了你的代码行,但它仍然不起作用。
    • 我认为您导入的方式(正如我在您的代码中看到的那样)不正确。执行“from tensorflow.python.ops import rnn_cell_impl”,然后使用 rnn_cell_impl.entity_name 引用“rnn_cell_impl”模块中的任何实体,例如 rnn_cell_impl._rnn_cell
    • 明白了,就像一个魅力。非常感谢您的时间和精力。
    猜你喜欢
    • 1970-01-01
    • 2021-10-22
    • 2011-01-22
    • 1970-01-01
    • 1970-01-01
    • 2021-05-10
    • 2018-09-02
    • 2019-07-04
    • 1970-01-01
    相关资源
    最近更新 更多