When I quantize a model with “Hardswish”, It’s got a Error with info:
AttributeError: ‘Hardswish’ object has no attribute ‘activation_post_process’,
And my coonfig is like this:
How could I fix this error? thanks
When I quantize a model with “Hardswish”, It’s got a Error with info:
AttributeError: ‘Hardswish’ object has no attribute ‘activation_post_process’,
And my coonfig is like this:
you are using qat prepare but normal qconfig. Also in the mapping, nnq.Hardswish isn’t a qat module. If you are intending to do qat you should do something like
import torch
qconfig = torch.quantization.get_default_qat_qconfig("fbgemm")
model = torch.nn.Sequential(torch.nn.modules.Hardswish(), torch.nn.modules.Linear(1,1))
model.qconfig = qconfig
model_prep = torch.quantization.prepare_qat(model)
print(model_prep)
model_prep(torch.randn(1,1))
if you are not intending to do qat you should do something like
import torch
qconfig = torch.quantization.get_default_qconfig("fbgemm")
model = torch.nn.Sequential(torch.nn.modules.Hardswish(), torch.nn.modules.Linear(1,1))
model.qconfig = qconfig
model_prep = torch.quantization.prepare(model)
print(model_prep)
model_prep(torch.randn(1,1))