ValueError: Please initialize `Prune` with a supported layer.

雪域幽狐 2021-03-02 14:47 阅读:5103


在做模型压缩剪枝时,报错ValueError: Please initialize `Prune` with a supported layer. Layers should either be a `PrunableLayer` instance, or should be supported by the PruneRegistry. You passed:
处理方式:在prune_registry.py里注册。如果使用的是anaconda3,则对应路径参考:
./anaconda3/envs/tensorflow2_latest_p37/lib/python3.7/site-packages/tensorflow_model_optimization/python/core/sparsity/keras/prune_registry.py
添加from tensorflow.python.keras.engine.functional import functional
然后在_LAYERS_WEIGHTS_MAP添加functional: [],

0条评论

登陆后可评论