File tree Expand file tree Collapse file tree 1 file changed +13
-14
lines changed
examples/cpu/inference/cpp Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change 33#include < memory>
44
55int main (int argc, const char * argv[]) {
6- torch::jit::script::Module module ;
7- try {
8- module = torch::jit::load (argv[1 ]);
9- }
10- catch (const c10::Error& e) {
11- std::cerr << " error loading the model\n " ;
12- return -1 ;
13- }
6+ torch::jit::script::Module module ;
7+ try {
8+ module = torch::jit::load (argv[1 ]);
9+ } catch (const c10::Error& e) {
10+ std::cerr << " error loading the model\n " ;
11+ return -1 ;
12+ }
1413
15- std::vector<torch::jit::IValue> inputs;
16- torch::Tensor input = torch::rand ({1 ,3 , 224 ,224 });
17- inputs.push_back (input);
14+ std::vector<torch::jit::IValue> inputs;
15+ torch::Tensor input = torch::rand ({1 , 3 , 224 , 224 });
16+ inputs.push_back (input);
1817
19- at::Tensor output = module .forward (inputs).toTensor ();
20- std::cout << output.slice (/* dim=*/ 1 , /* start=*/ 0 , /* end=*/ 5 ) << std::endl;
18+ at::Tensor output = module .forward (inputs).toTensor ();
19+ std::cout << output.slice (/* dim=*/ 1 , /* start=*/ 0 , /* end=*/ 5 ) << std::endl;
2120
22- return 0 ;
21+ return 0 ;
2322}
You can’t perform that action at this time.
0 commit comments