ComfyUI > Nodes > Basic data handling > Tensor Unary Op

ComfyUI Node: Tensor Unary Op

Class Name

TensorUnaryOp

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 Unary Op Description

Performs unary operations on tensors, enabling easy data transformation for AI tasks.

Tensor Unary Op:

The TensorUnaryOp node is designed to perform a variety of unary operations on tensors, which are multi-dimensional arrays commonly used in machine learning and data processing. This node allows you to apply mathematical functions to each element of a tensor individually, transforming the data in a way that can be useful for various computational tasks. By providing a selection of operations such as absolute value, negation, exponential, logarithm, trigonometric functions, square root, sigmoid, and ReLU, this node offers flexibility in manipulating tensor data. This capability is particularly beneficial for AI artists and developers who need to preprocess or modify data in a straightforward manner without delving into complex programming. The TensorUnaryOp node simplifies the process of applying these operations, making it accessible even to those with limited technical expertise.

Tensor Unary Op Input Parameters:

input

The input parameter accepts any data type that can be converted into a tensor. This parameter is crucial as it represents the data on which the unary operation will be performed. The input can be a list, a scalar, or an existing tensor. The node automatically converts non-tensor inputs into tensors, ensuring compatibility with the operations. There are no specific minimum or maximum values for this parameter, as it is designed to handle a wide range of data types and structures.

operation

The operation parameter specifies the unary operation to be applied to the input tensor. It offers a selection of operations including "abs" (absolute value), "neg" (negation), "exp" (exponential), "log" (logarithm), "sin" (sine), "cos" (cosine), "sqrt" (square root), "sigmoid" (sigmoid function), and "relu" (rectified linear unit). The default operation is "abs". This parameter determines how each element of the tensor will be transformed, and choosing the appropriate operation is essential for achieving the desired data manipulation. There are no minimum or maximum values, but the choice of operation should align with the intended data processing task.

Tensor Unary Op Output Parameters:

output

The output parameter is a tensor that results from applying the specified unary operation to the input tensor. This output retains the same shape as the input tensor but with each element transformed according to the chosen operation. The output tensor is crucial for subsequent data processing steps, as it provides the modified data ready for further analysis or use in machine learning models. Understanding the transformation applied to the data is important for interpreting the results and ensuring they meet the requirements of your specific task.

Tensor Unary Op Usage Tips:

  • Ensure that the input parameter is in a format that can be easily converted to a tensor, such as a list or a scalar, to avoid unnecessary conversion errors.
  • Choose the operation parameter carefully based on the desired transformation. For example, use "abs" to remove negative signs, "exp" to apply exponential growth, or "relu" to apply a non-linear activation function commonly used in neural networks.

Tensor Unary Op Common Errors and Solutions:

Unknown operation: <operation>

  • Explanation: This error occurs when the specified operation is not recognized by the node. It may be due to a typo or an unsupported operation.
  • Solution: Double-check the operation parameter to ensure it matches one of the supported operations: "abs", "neg", "exp", "log", "sin", "cos", "sqrt", "sigmoid", or "relu". Correct any typos or select a valid operation.

Input cannot be converted to a tensor

  • Explanation: This error arises when the input parameter is in a format that cannot be converted into a tensor, such as a complex data structure or unsupported data type.
  • Solution: Verify that the input is a list, scalar, or an existing tensor. If necessary, manually convert the input to a tensor format before passing it to the node.

Tensor Unary Op 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 Unary Op