Warning when saving variables in tensorflow 1.1.0
I am currently upgrading from .12.12 to 1.1 and I am getting a warning that I don’t understand when I am saving my trainable variables. I am running python 3.5.2 on Windows. Tensorflow was installed via pip and I am running on cpu only.
I can reproduce the warning with the following code:
import tensorflow as tf
from tensorflow.contrib import rnn
import numpy as np
batch_size = 1
timesteps = 1
rnn_size = 4
n_channels = 1
with tf.Graph().as_default():
input_data = tf.placeholder(tf.float32, [batch_size, timesteps, n_channels])
with tf.name_scope('connected_input'):
input_w = tf.get_variable('connected_w', [n_channels, rnn_size], initializer=tf.contrib.layers.xavier_initializer(seed=1), dtype=tf.float32)
input_b = tf.get_variable('connected_b', [rnn_size], initializer=tf.constant_initializer(0.0), dtype=tf.float32)
inputs = tf.nn.relu(tf.einsum('ijk,kl->ijl', input_data, input_w) + input_b)
inputs = tf.unstack(inputs, num=timesteps, axis=1)
lstm_cell = rnn.LSTMCell(4, state_is_tuple=True, initializer=tf.contrib.layers.xavier_initializer(seed=1))
cell = rnn.MultiRNNCell([lstm_cell] * 1, state_is_tuple=True)
initial_state = cell.zero_state(batch_size, tf.float32)
outputs, state = rnn.static_rnn(cell, inputs, initial_state=initial_state, scope='RNN')
with tf.Session(config=tf.ConfigProto(intra_op_parallelism_threads=4)) as sess:
tf.global_variables_initializer().run()
outputs_val, state_val = sess.run([outputs, state], {input_data:np.reshape(np.array(0), [1,1,1])})
saver = tf.train.Saver(var_list=tf.trainable_variables())
saver.save(sess, save_path='c:/tf_vars.dat')
This gives the following warning:
WARNING:tensorflow:Error encountered when serializing LAYER_NAME_UIDS.
Type is unsupported, or the types of the items don't match field type in CollectionDef.
'dict' object has no attribute 'name'
+3
source to share
No one has answered this question yet
Check out similar questions: