我想用冷冻器_图形.py工具保存模型,但遇到问题。在
在我的张量流图中有一个变量,我可以指定它使用tf.分配或在每个源之前。我需要它保持一个变量,因为tf.分配需要一个可变张量,也不能输入常量,但是freeze_graph脚本将所有变量转换为常量。在
我注意到freezeéu graph有白名单和黑名单参数,但我一辈子都找不到关于这些参数是什么或如何使用它们的任何文档。我能在这里做什么?在
编辑:
single_c
和{
single_c = tf.Variable(tf.random_uniform([num_lstm_cells], 0, 1), trainable=True)
expanded_c = tf.reshape(single_c, [1, num_lstm_cells])
batched_c = tf.tile(expanded_c, tiling_shape, name='c')
single_h = tf.Variable(tf.random_uniform([num_lstm_cells], 0, 1), trainable=True)
expanded_h = tf.reshape(single_h, [1, num_lstm_cells])
batched_h = tf.tile(expanded_h, tiling_shape, name='h')
state = tf.contrib.rnn.LSTMStateTuple(batched_c, batched_h)
因为我用以下方法分配它们:
^{pr2}$我使用
_, er, new = sess.run([train_nn_step, error, new_state], feed_dict={batch_ph: batch_size, prob: training_dropout, state: new})
如果single_c
和single_h
成为常量,我无法赋值或馈送
目前没有回答
相关问题 更多 >
编程相关推荐