set it as latent type
Re-labeling an any-wire as a LATENT — for the multi-sampler crowd
- a
- Latent
A latent in ComfyUI is a dictionary wrapping the noise-space tensor - {"samples": tensor, ...} - and it's the currency of every sampling loop. "Set it as latent type" exists for the workflows where that currency has passed through an any-typed junction and the editor can no longer vouch for it.
That's the pack's whole story, told once more: ComfyUI is strict about wire types, and any-typed junctions - cg-use-everywhere nodes, switches, API-fed inputs - strip type information. A latent that's been routed around ends up looking like *. Feed that into a KSampler's latent input and you may get a refusal at connection time or a crash mid-sampling. This node takes whatever is on a, returns it unchanged, and stamps the output LATENT, so it slots back into a KSampler's latent socket, a LatentUpscale, or a VAE Decode with the graph believing in it again.
Mechanically it's the same transparent two-liner as every sibling: exec(self, a=None): return (a,), with RETURN_TYPES = ("LATENT",) carrying the load. No resizing, no resampling, no validation - a label, not a converter.
When you'd reach for it
- You're running one sampling result into another (img2img, hires-fix chains, latent upscale passes) where the latent passes through routing nodes and a typed socket is being picky.
- Multi-sampler setups where one latent is fanned out through an any-wire.
- The usual README case: anything meant to "enhance use cg-use-everywhere."
If your workflow hands latents directly from encoder to sampler to decoder without detours, you will never touch this node, and that's correct.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/YMC-GitHub/ymc-node-as-x-type
or via ComfyUI Manager (search ymc-node-as-x-type), restart. No models to download; the four yors_* pip deps auto-install on startup. Find it by double-clicking and typing set it as, or right-click → YMC → LINK.
Gotchas
- Label, not conversion. If the wire holds anything but a
{"samples": ...}dict, the sampler will fail a step or two later. - One-commit, single-maintainer pack (v0.1.2, 2025) - a small utility with a matching small support surface.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| aopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Latent | LATENT | — |