テスト時にロードしたテンソルフローの事前訓練モデルがあります。私の質問は、どのように私のアーキテクチャのすべての重量が更新されていることを確認できますか?Tensorflow - ロードされた荷重を確認する方法
- 私のコードに重量があるとテンソルが上がりますか?
- 私のコードに重みが少なくてもテンソルがエラーになりますか?以下は
は、単純なスニペット
n_classes = 2
batch_size=1000
x = tf.placeholder(tf.float32, [None, 10, embedding_size], name='embedding')
keep_prob = tf.placeholder(tf.float32, name='keep_prob')
# weights - fc
fc1_w = tf.get_variable("fc1_w", shape=[1024, 256])
fc2_w = tf.get_variable("fc2_w", shape=[256, 256])
clf_w = tf.get_variable("clf_w", shape=[256, 2])
fc1_b = tf.get_variable("fc1_b", shape=[256])
fc2_b = tf.get_variable("fc2_b", shape=[256])
clf_b = tf.get_variable("clf_b", shape=[2])
# weights - lstm
lstm = tf.nn.rnn_cell.LSTMCell(num_units = 1024, state_is_tuple=True)
lstm_state = lstm.zero_state(batch_size, tf.float32)
sess = tf.Session()
saver = tf.train.Saver()
saver.restore(sess, "./checkpoints/model-24000")
ありがとうございます!私はlstmを確認する方法を知っていますか?私は[fc1_w、fc2_w、lstm、lstm_state]に合格しましたが、lstmsにはエラーが発生しました – kong
あなたが持っているエラーについてはわかりませんし、lstmについてよく分かりません。私はlstmとlstm_stateが変数だとは思わない。たぶん 'lstm.variables()'はlstmの変数のリストで、あなたが望むものです。 – Seven