Let’s say I have compiled a function (from python with jit) as;
for t in range(sequence.size(0)):
// until here everything in python, works perfect.
// main part for my question ; in my cpp file (where libtorch is configured & built perfect) I have ;
std::vectortorch::jit::IValue sequence_in; // just creating a sequence for testing
// These lines below are the cause of my confusion…
torch::jit::script::Module process_seq = torch::jit::load(“process_seq.torchjit”);
torch::Tensor sequence_out = process_seq.forward(sequence_in).toTensor();
My question is:
How do I call a single jit function (not a module) into cpp, and how can I execute that function?
ps: I’m definitely not a user of cpp… I know of namespaces, but the problem is which import from torch::jit::script:: I use as my variable type for the imported function…
Thank you in advance
Edit: The error msg I get is ;
libc++abi.dylib: terminating with uncaught exception of type c10::Error: Expected at most 2 argument(s) for operator ‘forward’, but received 3 argument(s). Declaration: forward(ClassType<process_seq> self, Tensor sequence) -> (None) (checkAndNormalizeInputs at …/aten/src/ATen/core/function_schema_inl.h:134)
Abort trap: 6