For exercise 5, after defining model=Siamese(), which returns trax.layers.combinators.Parallel, where can I find the reference on what should be passed into model() in the evaluation stage?
More specifically, where can I find the reference saying model((q1, q2)) or model([q1, q2]) being correct, but not model(q1, q2)?
I’m not sure I understand your question. Are you thinking that “evaluation stage” is somehow special compared to “training stage”? If it is the case, then no, model behaves the same way regarding the inputs.
I assume you know that (q1, q2) is one argument as is [q1, q2], but q1, q2 are two arguments?
When we defined Siamese(..) at the end:
# Run on Q1 and Q2 in parallel.
model = tl.Parallel(q_processor, q_processor)
return model
it is indicative that the model will run two q_processor layers (which each is tl.Serial) in parallel so the model needs the input to be fromed that way (made of two “streams” of data).
The links are provided right after “Exercise 02” where you can check the forward methods of tl.Parallel and tl.Serial. Specifically tl.Parallel checks if the number of inputs is the same number as of layers (if len(sublayer_inputs) != n_layers:).
As you can see the course staff chose that the input requires a tuple (each q_processor is Serial layer which requires one input). Trax has nothing to do with it.
The documentation for Parallel is linked in the last line before defining the exercise function.
Trax code is very readable so I personally prefer to look at the code (this is why I linked the code first). For example, PyTorch has a way better documentation, but the code (for the library) is way more complicated and requires more programming knowledge and time to familiarize with it.