Nodes/ComfyUI-RAVE/LatentGridCompose
ComfyUI Node

LatentGridCompose

Pack frame latents into a grid before you ever touch pixels

By spacepxl·Created 3 years ago·Updated 2 years ago· 95
LatentGridCompose
  • latents
  • LATENT
x_dim3
pad_gridfalse
randomfalse
rs0

LatentGridCompose is the latent-space twin of ImageGridCompose. Where the image version arranges decoded images, this one arranges the samples inside a LATENT - so it does the same gridding at 1/8th the resolution, before the VAE ever runs. It's the exact node the pack's KSampler (RAVE) uses each denoising step to lay a batch of frame latents out as one big grid image.

How it works

It takes a LATENT (a batch of frame latents), rearranges the samples tensor into x_dim × x_dim grid cells, and returns a new LATENT whose single "image" is the whole grid. Same random + rs shuffle logic as the image version: with randomness on, frames are placed randomly using the seed, so a downstream model can't learn frame positions - which is the whole trick behind RAVE's temporal consistency.

The one real difference from the image version is padding. pad_grid here adds 1 latent pixel per cell, not 8 - that's the same physical spacing, since latent space is 8× smaller. Use the same pad_grid on the decompose side and you're fine.

Inputs and output

  • latents - the frame LATENT batch.
  • x_dim (2–8, default 3) - cells per side.
  • pad_grid - 1 latent px per cell; keep it consistent across compose/decompose.
  • random + rs - shuffle placement; same values on LatentGridDecompose undo it.

Output is a LATENT - one grid per full grid_size² frames, black cells left over if the batch doesn't fill the last grid.

What you'd use it for

The obvious standalone trick: compose a batch of latents into a grid and run a single VAE decode, and you've turned N frames into one contact-sheet image in one pass instead of N decodes. It's also a clean way to preview what a batch of generations actually looks like, and it's the building block if you want to build your own grid-sampling loop outside of the pack's KSampler. Round-trips losslessly with LatentGridDecompose given matching x_dim, pad_grid, random and rs.

Installing it

Ships in ComfyUI-RAVE (menu: RAVE/Latent), zero extra dependencies, no models. ComfyUI Manager: search "ComfyUI-RAVE". Or:

cd ComfyUI/custom_nodes
git clone https://github.com/spacepxl/ComfyUI-RAVE

then restart ComfyUI.

CategoryRAVE/Latent

Inputs (5)

NameTypeDefaultDescription
latentsLATENT
x_dimINT32–8
pad_gridBOOLEANfalse
randomBOOLEANfalse
rsINT00–18446744073709550000

Outputs (1)

NameTypeDescription
LATENTLATENT