Thank you for replying. When I run the example in T5’doc, I get a logits with size(1,7,32128). 
WeChat220f3931580f22e83edb96409cd523ef1920×620 71.4 KB

Does this mean that the decoder has forwarded 7 times during training(with beam search, topp sampling or greedy search)? If so, where does this happen in the source code?I haven’t found it. I know it will forward 7 times when calling model.generate but not training or computing loss.
Thanks again for your time!