"docs/vscode:/vscode.git/clone" did not exist on "0af12f1f8a1682833c944354daeba0c9d9c0f342"
main.cpp 657 Bytes
Newer Older
moto's avatar
moto committed
1
2
3
#include <torch/script.h>

int main(int argc, char* argv[]) {
nateanl's avatar
nateanl committed
4
5
6
  if (argc != 4) {
    std::cerr << "Usage: " << argv[0]
              << " <JIT_OBJECT> <INPUT_FILE> <OUTPUT_FILE>" << std::endl;
moto's avatar
moto committed
7
8
9
10
    return -1;
  }

  torch::jit::script::Module module;
moto's avatar
moto committed
11
  std::cout << "Loading module from: " << argv[1] << std::endl;
moto's avatar
moto committed
12
13
  try {
    module = torch::jit::load(argv[1]);
nateanl's avatar
nateanl committed
14
  } catch (const c10::Error& error) {
moto's avatar
moto committed
15
16
17
18
19
20
    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])});
nateanl's avatar
nateanl committed
21
  std::cout << "Done." << std::endl;
moto's avatar
moto committed
22
}