mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/33851 Rationale and context described in #33828. Script to reproduce the move: https://gist.github.com/suo/16cbefaaeb67ca5a7c6caffd49b7f6e9 ghstack-source-id: 99079645 Test Plan: Make sure CI passes Reviewed By: jamesr66a Differential Revision: D20133869 fbshipit-source-id: 390e9241a9c85366d9005c492ac31f10aa96488e
21 lines
458 B
C++
21 lines
458 B
C++
#include <torch/jit.h>
|
|
#include <torch/script.h>
|
|
#include <torch/csrc/jit/api/module.h>
|
|
|
|
#include <iostream>
|
|
#include <fstream>
|
|
#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::script::Module m("TestModule");
|
|
|
|
m.define(buffer.str());
|
|
m.save(output_file_path);
|
|
}
|