Nodes/ComfyUI-latent-ops/LatentOperationInstanceNorm
ComfyUI Node

LatentOperationInstanceNorm

The zero-input node that normalizes style away

By hnmr293·Created about a year ago·Updated about a year ago· 2
LatentOperationInstanceNorm
    • op

    Here's a genuinely useful node with the most confusing presentation in the pack: LatentOperationInstanceNorm has no inputs at all. Open it and it's just an output labeled op. That's because instance norm doesn't need parameters - it computes per-channel mean and variance from the latent itself, normalizes to zero mean and unit variance, and there's nothing for you to tune. What it's for: stripping the "style" (contrast, brightness, intensity) out of a latent so that only structure remains. That's the classic prep step before mixing or interpolating latents, because differences in intensity will otherwise dominate the blend.

    It's from hnmr293's ComfyUI-latent-ops pack, and it's the purest demonstration of the pack's deferred-op design.

    How it works

    The node builds a closure that runs torch.nn.functional.instance_norm(latent, eps=1e-8) when applied. Instance norm normalizes each sample's channels independently across spatial dimensions: every channel ends up with mean 0 and variance 1. Two latents that are wildly different in brightness but similar in layout come out of this looking structurally alike - which is precisely why it's the workhorse trick before latent interpolation or addition. The epsilon is a fixed tiny constant for numerical stability; you can't change it from the UI, and you rarely need to.

    What matters

    • No inputs. Just the op output, a LATENT_OPERATION - a deferred operation.

    And here's where the pack's gotcha is at its most visible: with zero inputs and only an op output, this node cannot do anything unless something applies that op to a latent. The pack ships no Apply node, so you need a consumer that accepts LATENT_OPERATION (the author's own workflows use one) or a tiny custom node that calls op(latent["samples"]). If you expected to drag this into a graph and see results, you'll be confused - it's a recipe, not a result.

    Installing it

    No deps, no model files - ComfyUI Manager → search "ComfyUI-latent-ops" → install, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/hnmr293/ComfyUI-latent-ops
    

    Restart ComfyUI; it's under hnmr/latent_ops.

    Troubleshooting

    The typical user story is "I plugged it in and nothing happened" - that's the missing Apply step, and it's worth reading the deferred-op explanation above before blaming the install. Once applied, expect a latent whose structure is intact but whose intensity is gone; that's the intended effect, and it's the reason to pair instance norm with an interpolation or add step right after. If you want normalization that preserves global intensity instead of removing it, that's a different node (the pack's LayerNorm or Normalize variants) - instance norm is specifically the "drop the style, keep the layout" tool.

    Categoryhnmr/latent_ops

    Inputs (0)

    No inputs

    Outputs (1)

    NameTypeDescription
    opLATENT_OPERATION