Skip to content

Commit 872797f

Browse files
committed
update example code for libtorch 1.2 API
1 parent fa3f1a5 commit 872797f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

advanced_source/torch_script_custom_ops.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,13 +634,13 @@ custom operator, that loads and executes a serialized TorchScript model:
634634
}
635635
636636
// Deserialize the ScriptModule from a file using torch::jit::load().
637-
std::shared_ptr<torch::jit::script::Module> module = torch::jit::load(argv[1]);
637+
torch::jit::script::Module module = torch::jit::load(argv[1]);
638638
639639
std::vector<torch::jit::IValue> inputs;
640640
inputs.push_back(torch::randn({4, 8}));
641641
inputs.push_back(torch::randn({8, 5}));
642642
643-
torch::Tensor output = module->forward(std::move(inputs)).toTensor();
643+
torch::Tensor output = module.forward(std::move(inputs)).toTensor();
644644
645645
std::cout << output << std::endl;
646646
}

0 commit comments

Comments
 (0)