我正在尝试将下面的代码从TF 1.2更新到TF 2.0。当我使用所有“旧”行(由上面的注释old标记)运行代码时,我会收到以下警告:
WARNING: LSTMCell.__init__ (from tensorflow.python.ops.rnn_cell_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This class is equivalent as tf.keras.layers.LSTMCell, and will be replaced by tha
我正在使用双向RNN为编码器和解码器实现一个编码器解码器模型。由于我在编码器端初始化双向RNN,并且与双向RNN关联的权重和向量已经初始化,所以当我尝试在解码器端初始化另一个实例时,我得到以下错误: ValueError: Variable bidirectional_rnn/fw/gru_cell/w_ru already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope? 我试着在它自己的name_scope中定义每一个,如下所示,但是没有用: def enc(mes
在我的代码中:(在tf1.0上工作得很好)
from tensorflow.contrib.rnn.python.ops import core_rnn
from tensorflow.contrib.rnn.python.ops import core_rnn_cell
from tensorflow.contrib.rnn.python.ops import core_rnn_cell_impl
用tf1.2报告错误:从tensorflow.contrib.rnn.python.ops导入core_rnn ImportError:无法导入名称“core_rnn”
我尝试在Tensorflow中构建一个情感分析模型
def rnn_lstm(weights, biases, data_x, sequence_length, vocab_size, embedding_size):
# Use Tensor Flow embedding lookup and convert the input data set
with tf.device("/cpu:0"):
embedding = tf.get_variable("embedding43", [vocab_size, embedding_
~/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 impo