Added more PyTorch wrapper nodes.
This commit is contained in:
@@ -168,6 +168,14 @@
|
||||
| [Pt Le](pt_le.md) | Tests whether elements in the first PyTorch tensor are less than or equal to the corresponding elements in the second tensor. |
|
||||
| [Pt Lt](pt_lt.md) | Tests whether elements in the first PyTorch tensor are less than the corresponding elements in the second tensor. |
|
||||
| [Pt Ne](pt_ne.md) | Tests whether two PyTorch tensors are not equal element-wise. |
|
||||
## PyTorch wrapper - Indexing and Slicing Operations
|
||||
| Node | Description |
|
||||
| --- | --- |
|
||||
| [Pt Gather](pt_gather.md) | Generates a tensor based on the index tensor using PyTorch's `gather` function. |
|
||||
| [Pt Index Select](pt_index_select.md) | Extracts elements from the input tensor along a specified dimension using an index tensor. |
|
||||
| [Pt Masked Select](pt_masked_select.md) | Extracts elements from the input tensor whose corresponding value in `masked_tens` is `True`. |
|
||||
| [Pt Scatter](pt_scatter.md) | Generates a new tensor by replacing values at specified positions using an index tensor. |
|
||||
| [Pt Where](pt_where.md) | Generates a new tensor by selecting values based on a condition tensor. |
|
||||
## PyTorch wrapper - Logical operations
|
||||
| Node | Description |
|
||||
| --- | --- |
|
||||
@@ -189,6 +197,7 @@
|
||||
| [Pt Neg](pt_neg.md) | Computes the negation of each element in a PyTorch tensor. |
|
||||
| [Pt Sin](pt_sin.md) | Computes the sine of a PyTorch tensor element-wise. |
|
||||
| [Pt Sinh](pt_sinh.md) | Computes the hyperbolic sine of a PyTorch tensor element-wise. |
|
||||
| [Pt Sqrt](pt_sqrt.md) | Computes the square root of each element in a PyTorch tensor. |
|
||||
| [Pt Tan](pt_tan.md) | Computes the tangent of a PyTorch tensor element-wise. |
|
||||
| [Pt Tanh](pt_tanh.md) | Computes the hyperbolic tangent of a PyTorch tensor element-wise. |
|
||||
## PyTorch wrapper - Matrix operations
|
||||
@@ -198,6 +207,19 @@
|
||||
| [Pt Einsum](pt_einsum.md) | Performs Tensor operations specified in the Einstein summation equation. |
|
||||
| [Pt Mat Mul](pt_matmul.md) | Performs matrix multiplication on two PyTorch tensors. |
|
||||
| [Pt Mm](pt_mm.md) | Performs 2D matrix multiplication on two PyTorch tensors. |
|
||||
## PyTorch wrapper - Reduction operation & Summary statistics
|
||||
| Node | Description |
|
||||
| --- | --- |
|
||||
| [Pt Argmax](pt_argmax.md) | Computes the indices of the maximum values of a PyTorch tensor along the specified dimension(s). |
|
||||
| [Pt Argmin](pt_argmin.md) | Computes the indices of the minimum values of a PyTorch tensor along the specified dimension(s). |
|
||||
| [Pt Max](pt_max.md) | Computes the maximum values of a PyTorch tensor along the specified dimension(s). |
|
||||
| [Pt Mean](pt_mean.md) | Computes the mean of a PyTorch tensor along the specified dimension(s). |
|
||||
| [Pt Median](pt_median.md) | Computes the median of a PyTorch tensor along the specified dimension(s). |
|
||||
| [Pt Min](pt_min.md) | Computes the minimum values of a PyTorch tensor along the specified dimension(s). |
|
||||
| [Pt Prod](pt_prod.md) | Computes the product of a PyTorch tensor along the specified dimension(s). |
|
||||
| [Pt Std](pt_std.md) | Computes the standard deviation of a PyTorch tensor along the specified dimension(s). |
|
||||
| [Pt Sum](pt_sum.md) | Computes the sum of a PyTorch tensor along the specified dimension(s). |
|
||||
| [Pt Var](pt_var.md) | Computes the variance of a PyTorch tensor along the specified dimension(s). |
|
||||
## PyTorch wrapper - Size object support
|
||||
| Node | Description |
|
||||
| --- | --- |
|
||||
@@ -231,6 +253,7 @@
|
||||
| Node | Description |
|
||||
| --- | --- |
|
||||
| [Pt Permute](pt_permute.md) | Permutes the dimensions of a PyTorch tensor according to the specified order. |
|
||||
| [Pt Reshape](pt_reshape.md) | Reshapes a PyTorch tensor into a specified shape using `torch.reshape()`. |
|
||||
| [Pt Squeeze](pt_squeeze.md) | Removes a dimension at the specified position in the input tensor if it is of size 1. |
|
||||
| [Pt Unsqueeze](pt_unsqueeze.md) | Adds a singleton dimension at the specified position in the input tensor. |
|
||||
| [Pt View](pt_view.md) | Reshapes a PyTorch tensor into a specified shape using `torch.view()`. |
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# Pt Argmax
|
||||
Computes the indices of the maximum values of a PyTorch tensor along the specified dimension(s).
|
||||
|
||||
Specify the dimension in the `dim` field using an integer as shown below:
|
||||
```
|
||||
0
|
||||
```
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| dim | String |
|
||||
| keepdim | Boolean |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Reduction operation & Summary statistics
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,24 @@
|
||||
# Pt Argmin
|
||||
Computes the indices of the minimum values of a PyTorch tensor along the specified dimension(s).
|
||||
|
||||
Specify the dimension in the `dim` field using an integer as shown below:
|
||||
```
|
||||
0
|
||||
```
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| dim | String |
|
||||
| keepdim | Boolean |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Reduction operation & Summary statistics
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,59 @@
|
||||
# Pt Gather
|
||||
Generates a tensor based on the index tensor using PyTorch's `gather` function.
|
||||
|
||||
Specify the `dim` field using an integer to indicate the axis along which to gather elements.
|
||||
Each input tensor element is selected based on the index tensor.
|
||||
|
||||
For example, consider the following input tensor:
|
||||
```
|
||||
[ [10, 20, 30, 40, 50],
|
||||
[100, 200, 300, 400, 500]]
|
||||
```
|
||||
|
||||
and the corresponding index tensor:
|
||||
|
||||
```
|
||||
[ [0, 4, 3, 2, 0],
|
||||
[4, 3, 0, 0, 0]]
|
||||
```
|
||||
|
||||
If `dim = 0`, the function scans row-wise, treating each index value as a row index.
|
||||
If `dim = 1`, it scans column-wise, interpreting each index value as a column index.
|
||||
|
||||
Let's analyze the case where `dim = 1`:
|
||||
|
||||
* Start at row 0, column 0.
|
||||
* The index at this position is `index[0, 0] = 0`.
|
||||
* PyTorch selects the value at position 0 from the array `[10, 20, 30, 40, 50]`, which is `10`.
|
||||
* The result at this stage is:
|
||||
```
|
||||
[[10, ?, ?, ?, ?]
|
||||
[?, ?, ?, ?, ?]]
|
||||
```
|
||||
|
||||
* Moving to column 1: `index[0, 1] = 4`.
|
||||
* The value at index 4 in `[10, 20, 30, 40, 50]` is `50`.
|
||||
* The updated result is:
|
||||
```
|
||||
[[10, 50, ?, ?, ?]
|
||||
[?, ?, ?, ?, ?]]
|
||||
```
|
||||
|
||||
* Repeating this process for all elements constructs the final gathered tensor.
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| dim | Int |
|
||||
| index | String |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Indexing and Slicing Operations
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,41 @@
|
||||
# Pt Index Select
|
||||
Extracts elements from the input tensor along a specified dimension using an index tensor.
|
||||
|
||||
`dim` specifies the dimension along which the selection occurs.
|
||||
* For example, for 2D tensors:
|
||||
** If `dim=0`, `index` selects rows.
|
||||
** If `dim=1`, `index` selects columns (for 2D tensors).
|
||||
|
||||
`index` is a list of indices that will be converted into a tensor.
|
||||
|
||||
Example:
|
||||
```
|
||||
Input Tensor:
|
||||
[[1, 2, 3],
|
||||
[40, 50, 60],
|
||||
[700, 800, 900]]
|
||||
|
||||
index = "[0, 2]"
|
||||
dim = 0
|
||||
|
||||
Output Tensor:
|
||||
[[1, 2, 3],
|
||||
[700, 800, 900]]
|
||||
```
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| dim | Int |
|
||||
| index | String |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Indexing and Slicing Operations
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,34 @@
|
||||
# Pt Masked Select
|
||||
Extracts elements from the input tensor whose corresponding value in `masked_tens` is `True`.
|
||||
|
||||
Example:
|
||||
```
|
||||
Input Tensor:
|
||||
[[1, 2, 3],
|
||||
[40, 50, 60],
|
||||
[700, 800, 900]]
|
||||
|
||||
Masked Tensor:
|
||||
[[True, False, False],
|
||||
[False, True, False],
|
||||
[False, False, True]]
|
||||
|
||||
Output Tensor:
|
||||
[1, 50, 900]
|
||||
```
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| masked_tens | Tensor |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Indexing and Slicing Operations
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,24 @@
|
||||
# Pt Max
|
||||
Computes the maximum values of a PyTorch tensor along the specified dimension(s).
|
||||
|
||||
Specify the dimension(s) in the `dim` field using an integer, a list, or a tuple, as shown below:
|
||||
```
|
||||
0, [0], or (1, 2)
|
||||
```
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| dim | String |
|
||||
| keepdim | Boolean |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Reduction operation & Summary statistics
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,26 @@
|
||||
# Pt Mean
|
||||
Computes the mean of a PyTorch tensor along the specified dimension(s).
|
||||
|
||||
This node supports only floating-point or complex tensors as input.
|
||||
|
||||
Specify the dimension(s) in the `dim` field using an integer, a list, or a tuple, as shown below:
|
||||
```
|
||||
0, [0], or (1, 2)
|
||||
```
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| dim | String |
|
||||
| keepdim | Boolean |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Reduction operation & Summary statistics
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,29 @@
|
||||
# Pt Median
|
||||
Computes the median of a PyTorch tensor along the specified dimension(s).
|
||||
|
||||
Specify the dimension(s) in the `dim` field using an integer as shown below:
|
||||
```
|
||||
0
|
||||
```
|
||||
or
|
||||
```
|
||||
1
|
||||
```
|
||||
Note that PtMedian calls torch.median(), which returns the lower of the two numbers when the true median falls between them.
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| dim | String |
|
||||
| keepdim | Boolean |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Reduction operation & Summary statistics
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,24 @@
|
||||
# Pt Min
|
||||
Computes the minimum values of a PyTorch tensor along the specified dimension(s).
|
||||
|
||||
Specify the dimension(s) in the `dim` field using an integer, a list, or a tuple, as shown below:
|
||||
```
|
||||
0, [0], or (1, 2)
|
||||
```
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| dim | String |
|
||||
| keepdim | Boolean |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Reduction operation & Summary statistics
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,28 @@
|
||||
# Pt Prod
|
||||
Computes the product of a PyTorch tensor along the specified dimension(s).
|
||||
|
||||
Specify the dimension(s) in the `dim` field using an integer as shown below:
|
||||
```
|
||||
0
|
||||
```
|
||||
or
|
||||
```
|
||||
1
|
||||
```
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| dim | String |
|
||||
| keepdim | Boolean |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Reduction operation & Summary statistics
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,27 @@
|
||||
# Pt Reshape
|
||||
Reshapes a PyTorch tensor into a specified shape using `torch.reshape()`.
|
||||
The total number of elements must remain unchanged.
|
||||
|
||||
For example, if a tensor has shape (2, 3, 4), and `new_shape="[6, 4]"`,
|
||||
the output will have shape (6, 4).
|
||||
|
||||
Use -1 to automatically infer a dimension, e.g.:
|
||||
```
|
||||
[2, -1]
|
||||
```
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| new_shape | String |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Transform
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,24 @@
|
||||
# Pt Scatter
|
||||
Generates a new tensor by replacing values at specified positions using an index tensor.
|
||||
|
||||
* Target tensor (tens): Some of whose values are replaced.
|
||||
* Source tensor (src): Values from this tensor replace a part or whole of the target tensor.
|
||||
* Index tensor (index): Specifies the positions in the target tensor for replacement.
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| dim | Int |
|
||||
| index | String |
|
||||
| src | String |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Indexing and Slicing Operations
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,17 @@
|
||||
# Pt Sqrt
|
||||
Computes the square root of each element in a PyTorch tensor.
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens_a | Tensor |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Math operations
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,28 @@
|
||||
# Pt Std
|
||||
Computes the standard deviation of a PyTorch tensor along the specified dimension(s).
|
||||
|
||||
Specify 1 to use Bessel's correction (N-1) for sample standard deviation.
|
||||
Specify 0 to compute population standard deviation.
|
||||
|
||||
Specify the dimension(s) in the `dim` field using an integer, a list, or a tuple, as shown below:
|
||||
```
|
||||
0, [0], or (1, 2)
|
||||
```
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| correction | Int |
|
||||
| dim | String |
|
||||
| keepdim | Boolean |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Reduction operation & Summary statistics
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,24 @@
|
||||
# Pt Sum
|
||||
Computes the sum of a PyTorch tensor along the specified dimension(s).
|
||||
|
||||
Specify the dimension(s) in the `dim` field using an integer, a list, or a tuple, as shown below:
|
||||
```
|
||||
0, [0], or (1, 2)
|
||||
```
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| dim | String |
|
||||
| keepdim | Boolean |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Reduction operation & Summary statistics
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,28 @@
|
||||
# Pt Var
|
||||
Computes the variance of a PyTorch tensor along the specified dimension(s).
|
||||
|
||||
Specify 1 to use Bessel's correction (N-1) for sample variance.
|
||||
Specify 0 to compute population variance.
|
||||
|
||||
Specify the dimension(s) in the `dim` field using an integer, a list, or a tuple, as shown below:
|
||||
```
|
||||
0, [0], or (1, 2)
|
||||
```
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| correction | Int |
|
||||
| dim | String |
|
||||
| keepdim | Boolean |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Reduction operation & Summary statistics
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,23 @@
|
||||
# Pt Where
|
||||
Generates a new tensor by selecting values based on a condition tensor.
|
||||
|
||||
* `condition_tens` (torch.Tensor): Boolean tensor that determines which values are selected.
|
||||
* `true_tens` (torch.Tensor): Values to use where the condition is `True`.
|
||||
* `false_tens` (torch.Tensor): Values to use where the condition is `False`.
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| condition_tens | Tensor |
|
||||
| true_tens | Tensor |
|
||||
| false_tens | Tensor |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Indexing and Slicing Operations
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
Reference in New Issue
Block a user