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
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 Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
latents | LATENT | Yes | - | - | The input batch of latent representations containing multiple latent vectors to be filtered. |
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
select_every_nth | INT | Yes | 1 | 1 - 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_latents | INT | Yes | 0 | 0 - 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 Name | Data Type | Description |
|---|---|---|
| LATENT | LATENT | The filtered output batch of latent representations. |
| count | INT | The 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.
Select Every Nth Latent π₯π ₯π π ’ Node Source Code Link
The Select Every Nth Latent π₯π ₯π π ’ node is from the ComfyUI-VideoHelperSuite node package.
Comments
Sign in with GitHub to join the discussion.