Ich bin Zug LSTM NetzwerkWie extrahiert man alle Gewichte aus LSTM-Zelle in Vanila Tensorflow?
cell_fw = tf.contrib.rnn.BasicLSTMCell(HIDDEN_SIZE)
cell_bw = tf.contrib.rnn.BasicLSTMCell(HIDDEN_SIZE)
rnn_outputs, final_state_fw, final_state_bw = tf.contrib.rnn.static_bidirectional_rnn(
cell_fw=cell_fw,
cell_bw=cell_bw,
inputs=rnn_inputs,
dtype=tf.float32
)
Ferner Ich versuche, es zu speichern Koeffizienten:
d = {}
with tf.Session() as sess:
# train code ...
variables_names =[v.name for v in tf.global_variables()]
values = sess.run(variables_names)
for k,v in zip(variables_names, values):
d[k] = v
Wörterbuch d von jeder LSTM Zelle nur zwei Objekte haben:
[(k,v.shape) for (k,v) in sorted(d.items(), key=lambda x:x[0])]
[('bidirectional_rnn/bw/basic_lstm_cell/biases:0', (1024,)),
('bidirectional_rnn/bw/basic_lstm_cell/weights:0', (272, 1024)),
('bidirectional_rnn/fw/basic_lstm_cell/biases:0', (1024,)),
('bidirectional_rnn/fw/basic_lstm_cell/weights:0', (272, 1024)),
('char_embedding:0', (70, 16)),
('softmax_biases:0', (5068,)),
('softmax_weights:0', (5068, 512))]
I bin verwirrt. Jede LSTM-Zelle sollte bis zu 4 trainierbare Schichten enthalten oder nicht? Wenn ja, wie bekommt man alle Gewichte von der LSTM-Zelle ??
Ohh, es ist wahr. Danke, ich kann mich entspannen. – Roosh