Unable to get hidden layer result with libtorch JIT C++

Solution:

After I checked each variable’s value, I find the return value of the function is tuple instead of tensorlist.
The method is changed to toTuple() instead of toTensorList().
Then the problem is solved.
I think I just misunderstand the answer at convert_ivalue_to_tensor_or_tuple.