Hi @mhubii,
No I’m not trying to finetune the prebuilt models. I’m trying to re-use the prebuilt models according to my requirement.
If you see the network it has 1024 input feature and 1000 output feature.
(classifier): Linear(in_features=1024, out_features=1000, bias=True)

Where as I have only 2 features as output (Cats and dogs). For this purpose I need to change the classfiier according to my output features i.e 2. Now at the same time I don’t want to re-train the complete network. Hence I know I should freeze the network and change only the classfier part to avoid any complete re-training of network.  I know how to do all these steps in pytorch. Which I"ve already posted in my previous comment.
Now, when I try to do the same using C++ front end I’m not able to do so. This is because the network I’m trying to load is stored of the form torch::jit::script::Module. It just lets me load the stored model and I am not able to modify the output features to 2 instead of 1000.  I think this is because I’m not able to convert the torch::jit::script::Module to either torch::nn::Module or torch::nn::Sequential.
I want to know if there is any way in which I can convert the torch::jit::script::Module to either torch::nn::Module or torch::nn::Sequential.
I know while converting the model from torch.jit.script() in convert.py we can change it and store it and load the completed model in C++, that may work (I’m yet to try that). But I am more interested in the solution where I should be able to convert torch::jit::script::Module to either torch::nn::Module or torch::nn::Sequential.
Please let me know if I’m able to state my problem correctly. I will try to explain more if required.
Thanks and Regards,
SantMan