Video Helper Suite πŸŽ₯πŸ…₯πŸ…—πŸ…’/latentgenerated

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

latents_A
latents_B
LATENT
count
merge_strategy
COMBO
scale_method
COMBO
crop
COMBO
VideoHelperSuite

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 NameData TypeRequiredDefault ValueRange/OptionsDescription
latents_ALATENTYes--latents_A (input parameter): The first input latent space data, typically a dictionary containing keys like "samples".
latents_BLATENTYes--latents_B (input parameter): The second input latent space data, which will be merged with latents_A.
merge_strategyMERGESTRATEGIESYes--Merge strategy: Options include match A, match B, match smaller, or match larger.
scale_methodSCALEMETHODSYes--scale_method (input parameter): Specifies the interpolation algorithm used when scaling the latent tensor, such as bilinear or nearest-neighbor.
cropCROPMETHODSYes--crop (input parameter): Defines how to handle parts exceeding the target dimensions during scaling, such as center cropping or disabling cropping.

Outputs

Parameter NameData TypeDescription
LATENTLATENTLATENT (output parameter): The merged latent space data, containing the concatenated batch.
countINTcount (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.

The Merge Latents πŸŽ₯πŸ…₯πŸ…—πŸ…’ node is from the ComfyUI-VideoHelperSuite node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…