Hi, I am new to Deep Learning and Pytorch. I am interested in quantization and have gone through the Transfer learning and Post Training Static Quantization tutorial. However, there are a few questions that i hope to get some idea from the community.
For Transfer learning:
- I noticed that the quantized model implements a custom head, for fine tuning purpose. However, since the model is restructured due to the
from torch import nn
Step 1. Isolate the feature extractor.
model_fe_features = nn.Sequential(
model_fe.quant, # Quantize the input
model_fe.dequant, # Dequantize the output
Step 2. Create a new “head”
new_head = nn.Sequential(
Step 3. Combine, and don’t forget the quant stubs.
new_model = nn.Sequential(
- Why is there no new
forward()defined for it? Can the
forward()recognize the new network layout for the model automatically?
- I noticed that the tutorial transforms the pretrained model to quantized model by merging the intermediate operations such as
ConvBnReLU2d(). I know that the guideline in Quantization, suggests to perform operation fusing whenever quantizing a model. But is it possible to implement each quantized modules independently without fusing all of them as one? As i believe i have seen the quantization implementation of
nn.quantized.ReLU(). (Although there is no
- The reason i am asking is because i am interested in extracting the intermediate outputs. I would like to inspect the intermediate outputs such as output from
nn.quantized.ReLU()independently. I believe if i fuse the module using
ConvBnReLU2d, it would only yield me the final output that has gone through
ReLU()instead of the intermediate outputs for each intermediate operations, right?
I am new to this community and this is my first post. If this post does not follow the community guideline, please let me know. Thank you.