ComfyUI > Nodes > ComfyUI > LatentCut

ComfyUI Node: LatentCut

Class Name

LatentCut

Category
latent/advanced
Author
ComfyAnonymous (Account age: 763days)
Extension
ComfyUI
Latest Updated
2026-05-13
Github Stars
112.77K

How to Install ComfyUI

Install this extension via the ComfyUI Manager by searching for ComfyUI
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

LatentCut Description

Extract specific regions from latent tensor for focused analysis in complex models, offering flexible dimension slicing capabilities.

LatentCut:

The LatentCut node is designed to extract specific regions from a latent tensor, allowing you to focus on particular dimensions or sections of your data. This node is particularly useful in scenarios where you need to isolate or analyze a subset of your latent space, such as when working with complex models that generate multi-dimensional outputs. By providing the ability to slice through dimensions like x, y, or t, the LatentCut node offers a flexible approach to managing and manipulating latent data. This capability is essential for tasks that require precise control over the data being processed, enabling more targeted and efficient workflows.

LatentCut Input Parameters:

samples

This parameter represents the latent tensor from which you want to extract a region. It serves as the primary input data for the node, and its structure and content will determine the possible regions that can be extracted. The samples parameter is crucial as it forms the basis of the operation, and any changes or manipulations will be applied to this data.

dim

The dim parameter specifies the dimension along which the extraction will occur. You can choose from options such as x, y, or t, which correspond to different axes of the latent tensor. Selecting the correct dimension is vital as it dictates the orientation and direction of the slice, impacting the resulting data structure.

index

This parameter determines the starting point of the extraction along the chosen dimension. It can take values ranging from -nodes.MAX_RESOLUTION to nodes.MAX_RESOLUTION, with a default of 0. The index is essential for pinpointing the exact location within the dimension where the extraction should begin, allowing for precise control over the data subset.

amount

The amount parameter defines the number of elements to extract from the starting index along the specified dimension. It ranges from 1 to nodes.MAX_RESOLUTION, with a default value of 1. This parameter is crucial for determining the size of the extracted region, enabling you to tailor the output to your specific needs.

LatentCut Output Parameters:

samples

The output samples parameter contains the extracted region from the input latent tensor. This output is a modified version of the original data, reflecting the specified slice based on the input parameters. The extracted region can be used for further analysis or processing, providing a focused view of the latent space that aligns with your objectives.

LatentCut Usage Tips:

  • To extract a specific slice from a latent tensor, ensure you correctly identify the dimension (dim) and starting index (index) to achieve the desired result.
  • When working with large latent spaces, use the amount parameter to limit the size of the extracted region, optimizing performance and focusing on relevant data.

LatentCut Common Errors and Solutions:

IndexError: index out of range

  • Explanation: This error occurs when the specified index is outside the bounds of the chosen dimension in the latent tensor.
  • Solution: Verify that the index is within the valid range for the specified dimension and adjust it accordingly.

ValueError: amount exceeds dimension size

  • Explanation: This error happens when the amount parameter exceeds the available elements from the starting index in the chosen dimension.
  • Solution: Reduce the amount to fit within the bounds of the dimension, ensuring it does not exceed the available elements from the specified index.

LatentCut Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

LatentCut