tensorflow: 'module' object has no attribute
1722 단어 인공지능
실행 전에 실행할 수 있는 tensorflow 코드, 문제
'module' object has no attribute
In [1]: import tensorflow as tf
In [2]: tf.reset_default_graph() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) in () ----> 1 tf.reset_default_graph()
AttributeError: 'module' object has no attribute 'reset_default_graph'
In [3]: Y = tf.placeholder(tf.float32, [None, 6]) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) in () ----> 1 Y = tf.placeholder(tf.float32, [None, 6])
AttributeError: 'module' object has no attribute 'placeholder'
공식 문서를 보실 수 있습니다.
https://www.tensorflow.org/beta/guide/migration_guide
Convert Your Existing Code to TensorFlow 2.0
여기서는 먼저 가장 간단한 방법으로 위의 문제를 해결한다
It is still possible to run 1.X code, unmodified (except for contrib), in TensorFlow 2.0:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
'module' object has no attribute 'contrib'
tf.contrib.rnn.MultiRNNCell(lstm_layers)
MultiRNNCell로 어떻게 호출해야 합니까
디렉토리/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops
grep -nr BasicLSTMCell ./
/rnn_cell_impl.py:634:@tf_export(v1=["nn.rnn_cell.BasicLSTMCell"])
tf.nn.rnn_cell.BasicLSTMCell(N_HIDDEN_UNITS, forget_bias=1.0) Out[130]: