Giter VIP home page Giter VIP logo

Comments (4)

wanghaoshuang avatar wanghaoshuang commented on May 11, 2024
  1. 如何理解敏感度裁切中的greedy_prune和普通的prune区别?

greedy_prune一次只会剪裁topk不敏感的卷积层,topk默认为1.
prune一次会剪裁所有指定的卷积层。

from paddleslim.

wanghaoshuang avatar wanghaoshuang commented on May 11, 2024

2.下列代码中 ,#标出的部分有何意义?为什么要乘2?

这里代码是在估算:剪掉当前卷积层多少channel才能使模型的整体FLOPs减少指定的比例。

step1: 先剪掉50%的channel

pruned_program, _, _ = pruner.prune(
            program=graph.program,
            scope=None,
            params=[name],
            ratios=[0.5], ################# 注意这里
            place=None,
            lazy=False,
            only_graph=True)

step 2: 剪掉50%channel后,FLOPs减少了多少?

base_flops - flops(pruned_program)

step 3: FLOPs要减少10%, channel应该减少多少?

x/50% = target_pruned_flops / (base_flops - flops(pruned_program))
x = target_pruned_flops / (base_flops - flops(pruned_program))*2 #####所以有个2

from paddleslim.

wanghaoshuang avatar wanghaoshuang commented on May 11, 2024

3.下列代码中min_loss和max_loss初始值均为0,会导致while循环不执行

这里确实有问题,非常感谢反馈。
另外,更推荐参考这个教程,计算完敏感度后,手动调用剪裁接口:
https://paddlepaddle.github.io/PaddleSlim/tutorials/image_classification_sensitivity_analysis_tutorial.html

from paddleslim.

zhizunbao-y avatar zhizunbao-y commented on May 11, 2024

感谢解答

from paddleslim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.