main.cpp 643 Bytes
Newer Older
moto's avatar
moto committed
1
2
3
4
5
6
7
8
9
#include <torch/script.h>

int main(int argc, char* argv[]) {
  if (argc !=4) {
    std::cerr << "Usage: " << argv[0] << " <JIT_OBJECT> <INPUT_FILE> <OUTPUT_FILE>" << std::endl;
    return -1;
  }

  torch::jit::script::Module module;
moto's avatar
moto committed
10
  std::cout << "Loading module from: " << argv[1] << std::endl;
moto's avatar
moto committed
11
12
13
14
15
16
17
18
19
20
21
  try {
    module = torch::jit::load(argv[1]);
  } catch (const c10::Error &error) {
    std::cerr << "Failed to load the module:" << error.what() << std::endl;
    return -1;
  }

  std::cout << "Performing the process ..." << std::endl;
  module.forward({c10::IValue(argv[2]), c10::IValue(argv[3])});
  std::cout << "Done." << std::endl; 
}