Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于 量化算子的inference #170

Closed
huoshuai-dot opened this issue Jun 23, 2022 · 5 comments
Closed

关于 量化算子的inference #170

huoshuai-dot opened this issue Jun 23, 2022 · 5 comments

Comments

@huoshuai-dot
Copy link
Contributor

我想知道量化后的算子的前向过程是怎么计算的?想知道这块的代码是在哪里可以看到?比如uint8 的conv forward?ppq/executor/op/torch/default.py 这个脚本里面conv_forward()没看到相应的实现。

@ZhangZhiPku
Copy link
Collaborator

你是想看cuda的实现还是pytorch的实现?

@huoshuai-dot
Copy link
Contributor Author

你是想看cuda的实现还是pytorch的实现?

pytorch的

@ZhangZhiPku
Copy link
Collaborator

pytorch的实现可以看这个
https://github.com/openppl-public/ppq/blob/master/ppq/quantization/qfunction/linear.py

ppq使用tensor quantization config来控制量化流程,所有量化逻辑都绑定在算子身上,你可以通过op.config来访问这些tensor quantization config结构。ppq.executor在执行到每一个算子的时候,将去读取算子身上绑定的量化信息,并使用 linear.py 中定义的量化函数对数据进行处理。

@huoshuai-dot
Copy link
Contributor Author

linear.py 定义的是量化tensor的函数 那么 假设一个卷积 他的weight以及bias全部被量化成uint8类型之后 uint8的输入feature跟这些量化后的权重的卷积过程是调用哪些函数去执行呢?还是说pytorch支持uint8的卷积操作?

@ZhangZhiPku
Copy link
Collaborator

pytorch不支持uint8的卷积,linear.py里面量化完了还是浮点数哦,你再仔细看看...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants