pytorch / pytorch/tutorials

How to apply torch.quantization.quantize_dynamic for conv2d layer?

Open
#899 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

quantization
Dominant language
Python
Stars
9.3k
Forks
4.4k
Avg merge
1d 21h
Merged PRs (30d)
4

Description

I am working on quantizing resnet50 model. I tried to use the following command.

quantized_model = torch.quantization.quantize_dynamic(
    resnet18, {torch.nn.Conv2d,torch.nn.Linear}, dtype=torch.qint8
)

But only the linear layer has quaantized but not the convolutional layer. Can anyone help me how to dynamically quantize the convolutional layer?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the torch.quantization.quantize_dynamic entry point and reproduce the command using resnet18, Conv2d, and Linear. Check the quantization documentation for supported module types and determine whether the tutorials should clarify the observed behavior; done means the supported behavior and expected result are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.