小编yi *_*ang的帖子

如何在Tensorflow中保存和恢复分区变量

我有一个大矩阵.

我使用以下方式创建此变量作为分片数.

softmax_w = tf.get_variable("softmax_w", [hps.vocab_size, hps.projected_size],
                            partitioner=tf.fixed_size_partitioner(hps.num_shards, 0))
Run Code Online (Sandbox Code Playgroud)

创建日志:

model/softmax_w/part_0:0 (99184, 512) /cpu:0
model/softmax_w/part_1:0 (99184, 512) /cpu:0
model/softmax_w/part_2:0 (99184, 512) /cpu:0
model/softmax_w/part_3:0 (99184, 512) /cpu:0
model/softmax_w/part_4:0 (99184, 512) /cpu:0
model/softmax_w/part_5:0 (99184, 512) /cpu:0
model/softmax_w/part_6:0 (99183, 512) /cpu:0
model/softmax_w/part_7:0 (99183, 512) /cpu:0
Run Code Online (Sandbox Code Playgroud)

我可以训练并保存它的成功.但是当我尝试恢复模型时,我收到了这个错误:

W tensorflow/core/framework/op_kernel.cc:975] Not found: Key model/softmax_w/part_7 not found in checkpoint
W tensorflow/core/framework/op_kernel.cc:975] Not found: Key model/softmax_w/part_6 not found in checkpoint
W tensorflow/core/framework/op_kernel.cc:975] Not found: Key model/softmax_w/part_5 not found in checkpoint
W tensorflow/core/framework/op_kernel.cc:975] Not found: Key model/softmax_w/part_4 not …
Run Code Online (Sandbox Code Playgroud)

python machine-learning deep-learning tensorflow

8
推荐指数
1
解决办法
821
查看次数