Get Latent Count π₯π ₯π π ’(GetLatentCount)
From a technical implementation perspective, this node receives an input of type `LATENT`, which is a dictionary containing the key `"samples"`.
Get Latent Count
The Get Latent Count π₯π
₯π
π
’ node, from a technical implementation perspective, receives an input of type LATENT, which is a dictionary containing a "samples" key.
The Get Latent Count node is a utility node used to obtain the batch size of latent space data. Its core function is to receive a dictionary containing latent tensors and calculate the number of samples within it. This node is typically used in workflows that require dynamic understanding of data scale.
Node Functionality
From a technical implementation perspective, this node receives an input of type LATENT, which is a dictionary containing a "samples" key. Internally, the node accesses the latents["samples"] tensor and uses PyTorch's .size(0) method to get the size of this tensor along dimension 0 (i.e., the batch dimension). Its output is an integer (INT), representing the number of latent images or frames contained in the input batch.
Node Parameter Description - Get Latent Count π₯π ₯π π ’
Inputs
| Parameter Name | Data Type | Required | Default Value | Range/Options | Description |
|---|---|---|---|---|---|
latents | LATENT | Yes | - | - | Input parameter latents: Receives a dictionary in LATENT format. The node will extract and calculate the number of batch samples from it. |
Outputs
| Parameter Name | Data Type | Description |
|---|---|---|
| count | INT | Output parameter count: Outputs the total number of samples (or frames) contained in the input latent data, as an integer value. |
Usage Scenarios
This node is very useful in video generation or batch image processing workflows. For example, when you have latent video data composed of multiple frames and need to dynamically adjust the iteration count of subsequent loops (such as using the VHS_VideoCombine node) based on the number of frames, you can connect the count value output by this node to the max_frames parameter of the loop node, thereby achieving automated processing.
Notes
This node can only process standard ComfyUI LATENT format data. Its output depends entirely on the structure of the input data. If the input latents dictionary does not contain the expected "samples" key, the node may throw an error.
Get Latent Count π₯π ₯π π ’ Node Source Code Link
The Get Latent Count π₯π ₯π π ’ node is from the ComfyUI-VideoHelperSuite node package.
Comments
Sign in with GitHub to join the discussion.