# A question about the modeling\_bart.py

**URL:** <https://discuss.huggingface.co/t/a-question-about-the-modeling-bart-py/1930>\
**Category:** Models\
**Created:** [November 7, 2020, 4:29pm UTC](https://discuss.huggingface.co/t/a-question-about-the-modeling-bart-py/1930 "2020-11-07T16:29:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zuujhyt](https://avatars.discourse-cdn.com/v4/letter/z/f17d59/32.png) [@zuujhyt](https://discuss.huggingface.co/u/zuujhyt)\
**Post date:** [November 7, 2020, 4:29pm UTC](https://discuss.huggingface.co/t/a-question-about-the-modeling-bart-py/1930/1 "2020-11-07T16:29:34Z")

</div>

Hello,  
I have a question about one part.

> <https://github.com/huggingface/transformers/blob/07708793f20ec3a949ccab32cc4fe0c7272dcc4c/src/transformers/modeling_bart.py#L940>

Why the BartModel return not just decoder\_outputs  
and need to be decoder\_outputs + encoder\_outputs  
Thank you.

---

<div class="post-metadata">

**Author:** ![thomwolf](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/thomwolf/32/2198_2.png) [@thomwolf](https://discuss.huggingface.co/u/thomwolf)\
**Post date:** [November 12, 2020, 1:11pm UTC](https://discuss.huggingface.co/t/a-question-about-the-modeling-bart-py/1930/2 "2020-11-12T13:11:51Z")

</div>

Because when you do generation you usually do a single pass in the encoder and reuse it’s output for the subsequent token generation for efficiency so you need to access the encoder output from the first forward pass.
