全1掩码生成器
A one-click factory for 'attend to everything' masks
- tensor
- all_ones_mask
The name tells you everything: this node stamps out a mask of all ones. Not a clever mask, not a region mask - literally a tensor of 1s shaped to match your input tensor. It exists because this pack's attention and pooling nodes take mask inputs with a fixed convention (1 = keep, 0 = drop), and sometimes you want to say "keep everything" as an explicit value rather than leaving the socket empty.
The inputs are two: tensor, and seq_dim (default 1, range -4..4, negatives count from the end) - the axis you're treating as the "sequence" whose length the mask should match. The node reads the batch size from dimension 0, the sequence length from seq_dim, and produces an all-ones mask shaped [batch, seq_len] in int32, on the same device as the source tensor.
Why you'd actually reach for it:
- Feed it to
ConditioningPacker'sattention_maskinput when you want a conditioning to carry "no padding, attend to every token" metadata instead of nothing. - Feed it to
TensorPooledMerge'smask1/mask2when you want masked pooling that still keeps everything (handy as a no-op mask when a pipeline branch expects masks). - Use it as the building block when you need a base mask to modify downstream - a ones-mask you plan to zero out specific positions on is easier to start from than ones you have to invent.
The catch is the same one that runs through the whole pack: the TENSOR output is pack-internal, so this mask is only consumable by this pack's nodes that accept TENSOR (and by the conditioning path via ConditioningPacker). It's not a general-purpose mask you can plug into core ComfyUI masking nodes. Also note it's a 2D mask [B, S] - exactly what the pack's cross-attention nodes expect as a key-padding mask (their convention: ~mask.bool(), so 1 = valid). If you were expecting a 3D or per-head mask, this isn't that.
Honestly, it's the kind of node that looks pointless until you're mid-graph and need exactly one. It's a two-line torch.ones() wrapped in a UI - but in a string-based graph, a drag-in node that builds the mask with the right shape and device beats hand-wiring a Python script every time.
Install
ComfyUI Manager → search comfyui-spawner-nodes → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/spawner1145/comfyui-spawner-nodes
Deps: piexif, pypng, xmltodict - light pure-Python, no models, no downloads. README is a stub, UI labels are Chinese ("全1掩码生成器"), author is spawner1145, a Chinese-speaking dev known for a Wan2.1 SD extension. Works; documentation is basically nonexistent.
Troubleshooting
- Mask has the wrong length -
seq_dimis pointing at the wrong axis. On a[B, S, H]embedding,seq_dim=1is right; on a 2D tensor,1is the feature axis and you probably want0or a negative index. - "序列维度...对于形状...无效" - the dim you picked doesn't exist for that tensor's rank. The error names the shape.
- Mask won't plug into a core node - it's a pack-internal
TENSOR. Use it within this pack's conditioning/tensor nodes, not core masking sockets.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| tensor | TENSOR | — | |
| seq_dim | INT | 1-4–4 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| all_ones_mask | TENSOR | — |