ComfyUI > Nodes > Basic data handling > Tensor Permute

ComfyUI Node: Tensor Permute

Class Name

TensorPermute

Category
Basic/tensor
Author
StableLlama (Account age: 861days)
Extension
Basic data handling
Latest Updated
2026-05-07
Github Stars
0.04K

How to Install Basic data handling

Install this extension via the ComfyUI Manager by searching for Basic data handling
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Basic data handling 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

Tensor Permute Description

Rearranges tensor dimensions to align data for operations requiring specific input shapes.

Tensor Permute:

The TensorPermute node is designed to rearrange the dimensions of a tensor, allowing you to change the order in which data is organized within the tensor. This can be particularly useful when you need to align data dimensions for operations that require specific input shapes, such as matrix multiplications or when preparing data for machine learning models. By permuting the dimensions, you can effectively manipulate the tensor to fit the requirements of various computational tasks, enhancing flexibility and compatibility with different processing pipelines. This node is essential for tasks that involve complex data transformations, enabling you to tailor the data structure to meet specific needs without altering the underlying data values.

Tensor Permute Input Parameters:

tensor

The tensor parameter is the primary input for the TensorPermute node. It accepts any data that can be converted into a tensor, including lists, arrays, or existing tensors. This parameter represents the data structure whose dimensions you wish to rearrange. The input tensor can have any number of dimensions, and the node will handle the conversion to a PyTorch tensor if it is not already in that format. There are no specific minimum or maximum values for this parameter, as it is highly flexible and can accommodate various data types and shapes.

dims

The dims parameter specifies the new order of dimensions for the input tensor. It is a string that lists the indices of the dimensions in the desired order, separated by commas. For example, if you have a tensor with dimensions (2, 3, 4) and you want to rearrange it to (4, 2, 3), you would set dims to "2, 0, 1". The default value is "0, 1", which means no change to the order of dimensions. This parameter is crucial for defining how the data should be reorganized and must match the number of dimensions in the input tensor.

Tensor Permute Output Parameters:

tensor

The output of the TensorPermute node is a tensor with its dimensions rearranged according to the specified dims parameter. This output tensor retains the same data values as the input but in a new order, allowing for compatibility with different computational requirements. The permuted tensor can be used in subsequent operations that require a specific dimension order, making it a versatile tool for data manipulation and preparation.

Tensor Permute Usage Tips:

  • Ensure that the dims parameter matches the number of dimensions in the input tensor to avoid errors.
  • Use the TensorPermute node to prepare data for operations that require specific input shapes, such as neural network layers or matrix operations.
  • Experiment with different dimension orders to optimize data processing and improve computational efficiency.

Tensor Permute Common Errors and Solutions:

Failed to permute tensor with dims <dims>: <error_message>

  • Explanation: This error occurs when the dims parameter does not match the number of dimensions in the input tensor or contains invalid indices.
  • Solution: Verify that the dims string correctly lists all dimensions of the input tensor in the desired order. Ensure that each index is valid and corresponds to an existing dimension in the tensor.

Tensor Permute Related Nodes

Go back to the extension to check out more related nodes.
Basic data handling
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.

Tensor Permute