Nodes/ComfyAngel/ComfyAngel_Accumulate
ComfyUI Node

ComfyAngel_Accumulate

The hidden collector behind every Loop End

By ThepExcel·Created 8 months ago·Updated about a month ago· 14
ComfyAngel_Accumulate
  • existing
  • new_item
  • *

If you've used ComfyAngel's Loop Start / Loop End, you've already used Accumulate - you just never had to look at it. It's one of the pack's internal helper nodes, marked deprecated so it stays hidden from the menu, and it's the bit that makes results1/results2 on Loop End actually come out as a pile of results instead of a single lonely value.

Here's the whole job: you feed it two things, existing (what you've collected so far) and new_item (one more result from the current loop iteration), and it hands back the combined collection. The exact rule it follows matters more than the node itself, because it's the rule that governs every loop you build:

  • Tensors (IMAGE, MASK, LATENT): it tries to torch.cat along the batch dimension. Four images become one tensor of shape (4, H, W, C). That's the happy path - a clean batch you can feed straight into a Save Image.
  • Same shape, different problem: if two tensors don't match in height/width/channels, concat fails, so it silently falls back to returning a Python list of tensors. This is the trap. Your loop silently stopped producing a batch and you won't get an error - you'll get a list, and downstream nodes that expect a real IMAGE tensor will complain or misbehave.
  • Strings and everything else: collected into a plain Python list.

The new_item input is optional in the schema, and a None new_item just passes existing through untouched - the loop machinery relies on that.

When you'd actually touch it

You almost never add Accumulate to a graph by hand. If you're working in the Loop End's guts - say you're debugging why your collected images came out as a list - knowing the concat rule is what saves you: the fix for "I got a list, not a batch" is to make every iteration produce the same dimensions, which is exactly why the pack's folder loader ships a resize_mode. There are a couple of edge cases where people wire it directly, mostly to pre-seed a loop with a value or to collect a third stream the Loop End's two result slots don't cover.

Installing it

It's part of ComfyAngel, so install the pack once:

cd ComfyUI/custom_nodes
git clone https://github.com/ThepExcel/ComfyAngel.git

…then restart ComfyUI. ComfyUI Manager users can just search "ComfyAngel" and hit Install. The only Python dependency is Pillow - no models, nothing heavy.

The gotcha to remember

Because Accumulate is hidden (deprecated), you only see it in the menu if you enable "Show deprecated" - that's intentional, it's glue. The important thing isn't the node, it's the accumulation contract it enforces: tensors batch when shapes agree, and everything else becomes a list. If your loop's results "look wrong," check the shape story before you blame the loop.

CategoryComfyAngel/Loop/Internal

Inputs (2)

NameTypeDefaultDescription
existingopt*
new_itemopt*

Outputs (1)

NameTypeDescription
**