Solved by Michael_Suo in post #6 
              
              
                Can you try creating a compilation unit that all the OutputArchives share? Something like: 
    auto cu = std::make_shared<torch::jit::script::CompilationUnit>();
    torch::serialize::OutputArchive archive(cu);
    {
        torch::serialize::OutputArchive slot(cu);
        module->save(slot);
    …