# Cross attention for conditioning image generation

**URL:** <https://discuss.bayesflow.org/t/cross-attention-for-conditioning-image-generation/280>\
**Category:** General\
**Created:** [September 2, 2026, 10:52am UTC](https://discuss.bayesflow.org/t/cross-attention-for-conditioning-image-generation/280 "2026-09-02T10:52:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![corte](https://avatars.discourse-cdn.com/v4/letter/c/2acd7d/32.png) [@corte](https://discuss.bayesflow.org/u/corte)\
**Post date:** [September 2, 2026, 10:52am UTC](https://discuss.bayesflow.org/t/cross-attention-for-conditioning-image-generation/280/1 "2026-09-02T10:52:45Z")

</div>

Hi,

I have been working in a project in which I have to predict an image from an input with shape (timesteps, quantity). “timesteps” has a size of about 2000, while “quantity” about 500.  
In order to compress the input, I calculated the root mean square along the first entry, getting a single vector with shape ~500.  
I have seen that in the “inference network” page in the Bayesflow documentation it is written that “Image-generation subnets concatenate the condition channel-wise with the target image”.  
What I could do I think is to compress the “quantity” vector with, for example, a MLP, then reshape it for broadcasting to the image shape.  
However, I was wondering if cross-attention conditioning (used for example in Stable Diffusion) can be used in Bayesflow.

Thank you

---

<div class="post-metadata">

**Author:** ![KLDivergence](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.bayesflow.org/kldivergence/32/15_2.png) [@KLDivergence](https://discuss.bayesflow.org/u/KLDivergence)\
**Post date:** [September 8, 2026, 4:34pm UTC](https://discuss.bayesflow.org/t/cross-attention-for-conditioning-image-generation/280/2 "2026-09-08T16:34:07Z")

</div>

Hi Corte, this can work, but it will require a custom `subnet` backbone that combines the time series with the diffused image in the particular way you want. You can definitely reuse the existing attention machinery for it. We also have a diffusion transformer, but that one does not operate on images out of the box.
