Thank you, Thomas.


would you please point me to the exact example you are referring to? I tried several but no luck yet. If we write a wrapperclass Composition,  trace each subtask separately and combine them by calling forward(self, inputs) whose inputs is ["games", "fashion", "news", "food"]. This means, the final saved trace C++ model won’t be able to accept single channel like games, right?


For my code in previous post,
It seems that torch.jit.trace(loop_in_traced_fn, inputs) can ONLY accepts the inputs as tuple, so that  loop_in_traced_fn will get the tensor inside the inputs tuple. Am I correct?


It still not working yet, with error message shown below. I have also tried all kinds of input such as list of tuples, list of tensors, etc.

RuntimeError: 
Tensor cannot be used as a tuple:
@torch.jit.script
def loop_in_traced_fn(channel_tuple):
    result = []
    for channel in channel_tuple:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...  <--- HERE
        print(channel)
        channel = torch.tensor([channel], dtype=torch.int64)
        output = model(premise, premise_length, hypotheses, hypotheses_length, channel)
        result.append(output)
    return result