Thank you very much for your reply. That actually answers my question, but hopefully, I can take the opportunity to ask you another one. I am using a pretrained SqueezeNet 3D and in order to be able to load saved models I need to keep the nn.Sequential modules (namely self.features and self.classifier). I tried doing something like this:
        if self.quantize:
            # run Pooling operations and dropout in FP32
            x = self.quant(x)
            # x = self.features(x)
            for m in self.features:
                if isinstance(m, nn.MaxPool3d):
                    x = self.dequant(x)
                    x = m(x)
                    x = self.quant(x)
                else:
                    x = m(x)
            
            for c in self.classifier:
                if isinstance(c, nn.AvgPool3d) or isinstance(c, nn.Dropout):
                    x = self.dequant(x)
                    x = c(x)
                    x = self.quant(x)
                else:
                    x = c(x)
            x = x.view(x.size(0), -1)
            x = self.dequant(x)
            return x
        else:
            x = self.features(x)
            x = self.classifier(x)
            return x.view(x.size(0), -1)

This gives the following error:

RuntimeError:
Cannot re-assign ‘c’ because it has type value of type ‘torch.torch.nn.modules.pooling.AvgPool3d’ and c is not a first-class value.  Only reassignments to first-class values are allowed:
File “/home/ctm/afonso/easyride/acceleration/src/models/squeezenet.py”, line 152
        for c in self.classifier:
            if isinstance(c, nn.AvgPool3d) or isinstance(c, nn.Dropout):
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
                x = self.dequant(x)
                x = c(x)


Although not understanding why, I actually managed to fix the problem using the following code extract instead of the classifier loop:
            x = self.dequant(x)
            x = self.classifier[0](x)
            x = self.quant(x)
            x = self.classifier[1](x)
            x = self.classifier[2](x)
            x = self.dequant(x)
            x = self.classifier[-1](x)

I still do not fully understand how the TorchScript inspector works. I would appreciate if you could give me some insights on this behaviour.