@ptrblck Thank you for your reply.
I can convert it to torchscript in script mode.
However I need to have it in traced mode. I am converting it by AWS neo which is based on Apache TVM.
So I need to solve this error.
Only tensors, lists, tuples of tensors, or dictionary of tensors can be output from traced functions
You are getting this error because your model will be giving an output which is not tensors, lists, tuples of tensors or dictionary of tensors.
This can be fixed by modifying the forward function of your model class. Just wrap the current output with torch.tensor($current_output$).