我正在尝试使用TFLite量化一个经过修剪的tensorflow模型。剪枝和量化都是独立工作的,但是当我尝试剪枝然后剪枝时,我得到这个错误:ValueError: Input 0 of node sequential/prune_low_magnitude_dense/AssignVariableOp was passed float from sequential/prune_low_magnitude_dense/Mul/ReadVariableOp/resource:0 incompatible with expected resource.
,当我尝试剪枝然后剪枝时,我得到这个错误:ValueError: 'prune_low_magnitude' can only prune an object of the following types: tf.keras.models.Sequential, tf.keras functional model, tf.keras.layers.Layer, list of tf.keras.layers.Layer. You passed an object of type: bytes.
我应该如何使这些操作兼容?该模型为tf.keras.models.Sequential类型,出于测试目的,仅为一层深
如本例所示:
https://github.com/tensorflow/model-optimization/blob/master/tensorflow_model_optimization/python/examples/quantization_with_sparsity/keras/mnist_cnn.py
看来你应该把修剪的部分去掉
相关问题 更多 >
编程相关推荐