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

Select Every Nth Latent πŸŽ₯πŸ…₯πŸ…—πŸ…’(SelectEveryNthLatent)

This node receives a standard LATENT input, which internally contains a tensor named `samples`, representing multiple latent images.

Select Every Nth Latent

latents
LATENT
count
select_every_nth
INT
skip_first_latents
INT
VideoHelperSuite

The Select Every Nth Latent πŸŽ₯πŸ…₯πŸ…—πŸ…’ node receives a standard LATENT input, which internally contains a tensor named samples, representing multiple latent images.

The Select Every Nth Latent node is a tool for processing and filtering latent space data. Its core function is to systematically extract a subset of vectors from a batch containing multiple latent vectors based on a specified interval and starting point. This is primarily used to reduce data volume or create specific sampling sequences without the need for complex scripts or manual operations.

Node Functionality

This node receives a standard LATENT input, which internally contains a tensor named samples, representing multiple latent images. The node works by applying the same slicing operation to all tensors within the input LATENT dictionary that have the same length as samples: it skips a specified number at the beginning and then selects every Nth element thereafter. This ensures that all data related to the latent representation (such as noise predictions) are filtered synchronously, maintaining data consistency.

Node Parameter Description - Select Every Nth Latent πŸŽ₯πŸ…₯πŸ…—πŸ…’

Connection Inputs (Inputs)

Parameter NameData TypeRequiredDefault ValueValue Range/OptionsDescription
latentsLATENTYes--The input batch of latent representations containing multiple latent vectors to be filtered.

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueValue Range/OptionsDescription
select_every_nthINTYes11 - BIGMAX (Step: 1)The selection interval, must be greater than or equal to 1. For example, setting it to 2 selects every other latent vector.
skip_first_latentsINTYes00 - BIGMAX (Step: 1)The number of latent vectors to skip at the beginning, must be greater than or equal to 0. Skips the specified number of latent vectors before starting the interval selection.

Output

Parameter NameData TypeDescription
LATENTLATENTThe filtered output batch of latent representations.
countINTThe number of latent vectors contained in the output batch.

Usage Scenarios

This node is very useful in video generation or image batch processing workflows. For example, after using a video interpolation model to generate latent representations for a large number of intermediate frames, you might only need a subset for preview or further processing. You can connect this node to the output of the interpolation node and set select_every_nth to 2 to extract every other frame, quickly halving the frame rate, or skip the first few frames to ignore unstable initial segments.

Notes

When using this node, note that the skip_first_latents parameter sets the number of frames to skip. If this value is greater than or equal to the total number of input latent vectors, the output will be empty. Also, select_every_nth must be at least 1. Setting it to 1 means selecting all vectors that were not skipped, effectively performing only the skip operation.

The Select Every Nth Latent πŸŽ₯πŸ…₯πŸ…—πŸ…’ node is from the ComfyUI-VideoHelperSuite node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…