Merge Latents π₯π ₯π π ’(MergeLatents)
This node determines the final output dimensions by comparing the sizes of two input latent tensors and following the user-selected merging strategy (such as match A, match B, match smaller, or match larger).
Merge Latents
The Merge Latents π₯π ₯π π ’ node determines the final output dimensions by comparing the sizes of two input latent tensors and following a user-selected merge strategy (such as match A, match B, match smaller, or match larger).
The Merge Latents node is a tool within the Video Helper Suite specifically designed for merging two latent space data sets. Its core function is to fuse latent representations from different sources or of different sizes into a unified batch for subsequent processing.
Node Functionality
This node compares the dimensions of two input latent tensors and determines the final output dimensions based on the user-selected merge strategy (e.g., match A, match B, match smaller, or match larger). When input dimensions are inconsistent, it scales one of the tensors using the specified scaling method (e.g., bilinear or nearest-neighbor interpolation) and cropping method (e.g., center or disabled) to ensure both have consistent dimensions. It then concatenates them along the batch dimension.
Node Parameter Description - Merge Latents π₯π ₯π π ’
Inputs
| Parameter Name | Data Type | Required | Default Value | Range/Options | Description |
|---|---|---|---|---|---|
latents_A | LATENT | Yes | - | - | latents_A (input parameter): The first input latent space data, typically a dictionary containing keys like "samples". |
latents_B | LATENT | Yes | - | - | latents_B (input parameter): The second input latent space data, which will be merged with latents_A. |
merge_strategy | MERGESTRATEGIES | Yes | - | - | Merge strategy: Options include match A, match B, match smaller, or match larger. |
scale_method | SCALEMETHODS | Yes | - | - | scale_method (input parameter): Specifies the interpolation algorithm used when scaling the latent tensor, such as bilinear or nearest-neighbor. |
crop | CROPMETHODS | Yes | - | - | crop (input parameter): Defines how to handle parts exceeding the target dimensions during scaling, such as center cropping or disabling cropping. |
Outputs
| Parameter Name | Data Type | Description |
|---|---|---|
| LATENT | LATENT | LATENT (output parameter): The merged latent space data, containing the concatenated batch. |
| count | INT | count (output parameter): The total number of latent samples in the output batch, typically the sum of the two input batch sizes. |
Usage Scenarios
This node is highly useful in video generation or image batch processing workflows. For example, when you have two latent sequences generated from different conditions (such as different prompts) and wish to merge them for decoding or applying the same transformations in one go, you can use this node. It simplifies the process of handling multiple latent data sources.
Notes
Please note that this node currently primarily processes the "samples" attribute of latent tensors; other latent attributes may not be preserved. Additionally, scaling operations may affect image quality, especially during significant scaling. It is important to choose an appropriate scaling method based on the specific scenario.
Merge Latents π₯π ₯π π ’ Node Source Code Link
The Merge Latents π₯π ₯π π ’ node is from the ComfyUI-VideoHelperSuite node package.
Comments
Sign in with GitHub to join the discussion.