ComfyUI  >  Nodes  >  ComfyUI-Image-Filters >  AdaIN (Latent)

ComfyUI Node: AdaIN (Latent)

Class Name


spacepxl (Account age: 295 days)
Latest Updated
Github Stars

How to Install ComfyUI-Image-Filters

Install this extension via the ComfyUI Manager by searching for  ComfyUI-Image-Filters
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-Image-Filters in the search bar
After installation, click the  Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

AdaIN (Latent) Description

Perform adaptive instance normalization on latent representations for style transfer tasks, blending styles in a controlled manner.

AdaIN (Latent):

The AdainLatent node is designed to perform adaptive instance normalization (AdaIN) on latent representations. This technique is particularly useful in style transfer tasks, where the goal is to adjust the style of one image to match the style of another. By normalizing the latent features of an input image to match the statistical properties (mean and standard deviation) of a reference image, this node allows you to blend styles in a controlled manner. The AdainLatent node provides a flexible and powerful way to manipulate latent spaces, enabling you to achieve a wide range of artistic effects by simply adjusting a few parameters.

AdaIN (Latent) Input Parameters:


This parameter represents the latent representation of the input image that you want to modify. It is a tensor containing the latent features that will be normalized to match the reference image's style.


This parameter is the latent representation of the reference image whose style you want to apply to the input image. The node will use the statistical properties (mean and standard deviation) of this reference latent to adjust the input latent.


The factor parameter controls the degree to which the input latent is adjusted to match the reference latent. It is a floating-point value with a default of 1.0, a minimum of -10.0, and a maximum of 10.0. A factor of 1.0 means full application of the reference style, while a factor of 0.0 means no change to the input latent. Negative values and values greater than 1.0 can be used for more extreme adjustments.

AdaIN (Latent) Output Parameters:


The output is a modified latent representation that has been normalized to match the style of the reference latent. This output can be used in subsequent nodes to generate images that blend the input and reference styles.

AdaIN (Latent) Usage Tips:

  • To achieve a subtle style transfer, use a factor value between 0.0 and 1.0. This will blend the input and reference styles smoothly.
  • For more dramatic style changes, experiment with factor values greater than 1.0 or less than 0.0. Be cautious with extreme values as they can lead to unexpected results.
  • Use high-quality reference images with distinct styles to get the best results from the AdainLatent node.

AdaIN (Latent) Common Errors and Solutions:

"RuntimeError: The size of tensor a (X) must match the size of tensor b (Y)"

  • Explanation: This error occurs when the dimensions of the input and reference latents do not match.
  • Solution: Ensure that both the input and reference latents have the same dimensions before passing them to the AdainLatent node.

"TypeError: 'NoneType' object is not subscriptable"

  • Explanation: This error may occur if the input or reference latents are not properly loaded or are missing.
  • Solution: Verify that both the input and reference latents are correctly loaded and not None before using the node.

"ValueError: Expected more than 1 value per channel when training"

  • Explanation: This error can happen if the batch size of the latents is too small.
  • Solution: Ensure that the batch size of the input and reference latents is greater than 1 to avoid this error.

AdaIN (Latent) Related Nodes

Go back to the extension to check out more related nodes.

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.