Hi, I’ve traced my model as in TorchScript trace to support named tuple or dictionary i/o · Issue #16453 · pytorch/pytorch · GitHub 1
My question is how can I pass two tensors to forward()?
This is my code.
at::Tensor a = torch:tensor({1, 2,3});
at::Tensor b = torch:tensor({4});
auto inputList = c10::List<torch::Tensor>({a, b});
std::vector<torch::jit::IValue> inputs;
inputs.push_back(inputList);
auto out = moModel.forward(inputs).toTensor();

It gives this error.
terminate called after throwing an instance of 'c10::Error'
  what():  forward() Expected a value of type 'Tensor' for argument 'audio_signal' but instead found type 'List[Tensor]'.
Position: 1
Declaration: forward(__torch__.nemo.collections.asr.modules.conformer_encoder.ConformerEncoder self, Tensor audio_signal, Tensor length) -> ((Tensor, Tensor))
Exception raised from checkArg at ../aten/src/ATen/core/function_schema_inl.h:162 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) + 0x6b (0x7fec240b670b in /opt/libtorch/lib/libc10.so)
frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) + 0xce (0x7fec240b23ee in /opt/libtorch/lib/libc10.so)
frame #2: <unknown function> + 0xf39a22 (0x7feb7c73ca22 in /opt/libtorch/lib/libtorch_cpu.so)
frame #3: <unknown function> + 0xf3d0ec (0x7feb7c7400ec in /opt/libtorch/lib/libtorch_cpu.so)
frame #4: torch::jit::GraphFunction::operator()(std::vector<c10::IValue, std::allocator<c10::IValue> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, c10::IValue, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, c10::IValue> > > const&) + 0x2d (0x7feb7f04d7cd in /opt/libtorch/lib/libtorch_cpu.so)
frame #5: torch::jit::Method::operator()(std::vector<c10::IValue, std::allocator<c10::IValue> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, c10::IValue, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, c10::IValue> > > const&) + 0x161 (0x7feb7f05b351 in /opt/libtorch/lib/libtorch_cpu.so)
frame #6: <unknown function> + 0x13f9f (0x55e6e44d0f9f in ./demo_conformer)
frame #7: <unknown function> + 0xfbfb (0x55e6e44ccbfb in ./demo_conformer)
frame #8: <unknown function> + 0x70f9 (0x55e6e44c40f9 in ./demo_conformer)
frame #9: __libc_start_main + 0xf3 (0x7feb2eef20b3 in /usr/lib/x86_64-linux-gnu/libc.so.6)
frame #10: <unknown function> + 0x6aee (0x55e6e44c3aee in ./demo_conformer)

Thanks in advance.