Pytorch Model to C++ Model

Hello all,

I have a pytorch model of size 13.6 mb , I need to convert that into c++ for better performance.

I have followed the below steps but after conversion the model size become 4mb.and If I try running both models with same inputs … the outputs are very strange and mismatching.

here is what I tried:

model = ConvTasNet.load_model(“C:/Users/user/Desktop/dss/dss_code/src/Models/13mb.tar”)
model.eval()
example = torch.rand(1,160)
traced_script_module = torch.jit.trace(model, example)
traced_script_module.save(“m13mb.pt”)

Error is:

TracerWarning: Converting a tensor to a Python index might cause the trace to be incorrect. We can’t record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!

can anyone help in this regard?

Thanks,
Yugesh.