mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
This reverts commit 7ed377f5776578aec4a6a9bc4eeef221a6b80a77. Reverted https://github.com/pytorch/pytorch/pull/153656 on behalf of https://github.com/larryliu0820 due to Still being used internally so can't remove ([comment](https://github.com/pytorch/pytorch/pull/153656#issuecomment-2887665403))
21 lines
450 B
C++
21 lines
450 B
C++
#include <torch/csrc/jit/api/module.h>
|
|
#include <torch/jit.h>
|
|
#include <torch/script.h>
|
|
|
|
#include <fstream>
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
int main(int argc, char* argv[]) {
|
|
std::string input_file_path{argv[1]};
|
|
std::string output_file_path{argv[2]};
|
|
|
|
std::ifstream ifs(input_file_path);
|
|
std::stringstream buffer;
|
|
buffer << ifs.rdbuf();
|
|
torch::jit::Module m("TestModule");
|
|
|
|
m.define(buffer.str());
|
|
m.save(output_file_path);
|
|
}
|