Tencent / PocketFlow

An Automatic Model Compression (AutoMC) framework for developing smaller and faster AI applications.
https://pocketflow.github.io
Other
2.79k stars 490 forks source link

can't export channel_pruned_gpu model #306

Closed hudengjunai closed 5 years ago

hudengjunai commented 5 years ago

Describe the bug restore channel pruned gpu cifar10 example. FailedPreconditionError: Attempting to use uninitialized value model/resnet_model/batch_normalization_8/gamma [[Node: model/resnet_model/batch_normalization_8/gamma/_274 = _Send[T=DT_FLOAT, client_terminated=false,

To Reproduce Steps to reproduce the behavior:

  1. act as the tutorial ,train a cifar10 from scracth
  2. channel pruning cifar10 pretrain model then model
  3. load the meta file and ckpt ,export the model/resnet_model/final_dense as output to frozen the pb and export .then encouter the error
  4. The error is uninitialized parameter when tf.graph_util.convert_variables_to_constant .error discription is :FailedPreconditionError: Attempting to use uninitialized value model/resnet_model/batch_normalization_8/gamma"

Expected behavior the tutorial is not exactly correct to run. show detail tools/conversion/export_pb_tflite_models.py for cifar10 example

Context ubuntu:16.04 tf 1.10.0 python 3.6

hudengjunai commented 5 years ago

problem solved tf.graph_util.convert_variables_to_constants(sess,graph_def,[ 'pruned_model/resnet_model/final_dense'] will work properly.