[bug] Precedence of operations in VAE should be slicing -> tiling by a-r-r-o-w · Pull Request #9342 · huggingface/diffusers (original) (raw)

I think it's okay without a test here. The functionality is effectively similar and only affects the "batch_size" dim across this conv layer - which will never alter outputs as conv doesn't operate on that.

I know that understanding the changes here is quite easy, but I feel I should leave a comment making the explanation a bit more clear and elaborate for anyone stumbling upon this in the future.

Previously, slicing worked individually and tiling worked individually. When both were enabled, only tiling would be in effect meaning it would chop [B, C, H, W] to 4 tiles of shape [B, C, H // 2, W // 2] (assuming we have 2x2 perfect tiles), process each tile individually and perform blending.

This is incorrect as slicing is completely ignored. The correct processing size, ensuring slicing also took effect, would be 4 x B tiles with shape [1, C, H // 2, W // 2] - which this PR does.