How to process c++ forward multiple return values

my model return value like this , it is detection model
output = (
tensor1, # loc preds
tensor2 # conf preds
)

how to get return values in c++

i try this

auto outputs = module->forward(inputs).toTuple();
cout << ouputs << endl;

the stdout is 1,it’s not ok.

@111117 Hello, do you have a solution to this problem? I come across the same problem and cannot find any solution yet.

You could return one tensor containing all the information (like the concatenation of tensor1 and tensor2), and then use view or narrow to retrieve the relevant tensor.

Hi @Hartbook, could you give an example?
What if the shape of tensors are different. How to retrieve or partition the returned single tensor?
Thank you very much.