![](/img/trans.png)
[英]Tensorflow: AttributeError: module 'tensorflow.python.ops.nn' has no attribute 'softmax_cross_entropy_with_logits_v2'
[英]Tensorflow Module Import error: AttributeError: module 'tensorflow.python.ops.nn' has no attribute 'rnn_cell'
嘗試通過我的RNN呼叫時,我調用tf.nn.rnn_cell並收到以下錯誤:
AttributeError: module 'tensorflow.python.ops.nn' has no attribute 'rnn_cell'
這很奇怪,因為我確定我正確地導入了一切:
from __future__ import print_function, division
from tensorflow.contrib import rnn
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
但是看看文檔,事情已經在tensorflow版本之間移動了。
你會推薦什么來解決這個問題?
行,我收到錯誤:
state_per_layer_list = tf.unstack(init_state, axis=0)
rnn_tuple_state = tuple(
[tf.nn.rnn_cell.LSTMStateTuple(state_per_layer_list[idx][0], state_per_layer_list[idx][1])
for idx in range(num_layers)]
)
特別:
tf.nn.rnn_cell
我正在使用anaconda 3來管理所有這些,所有的依賴都應該得到照顧。 我已經嘗試用Tensor形狀來解決該死的等級/形狀錯誤,需要花費很長時間才能解決。
提前干杯。
用tf.nn.rnn_cell
替換tf.contrib.rnn
從版本1.0開始, rnn
作為contrib模塊的一部分實現。
更多信息可以在這里找到https://www.tensorflow.org/api_guides/python/contrib.rnn
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.