Added various PyTorch wrapper nodes to generate tensors.
This commit is contained in:
@@ -213,7 +213,13 @@
|
||||
| [Pt From Image](pt_from_image.md) | Casts an Image tensor as a PyTorch tensor. |
|
||||
| [Pt From Latent](pt_from_latent.md) | Casts a latent tensor as a PyTorch tensor. |
|
||||
| [Pt From Numpy](pt_from_numpy.md) | Converts a NumPy ndarray to a PyTorch tensor while preserving its data type. |
|
||||
| [Pt Full](pt_full.md) | Creates a PyTorch tensor filled with a specified value using the size entered in the text field. |
|
||||
| [Pt Int Create](pt_int_create.md) | Creates a PyTorch tensor with 32-bit integer |
|
||||
| [Pt Ones](pt_ones.md) | Creates a PyTorch tensor of ones using the size entered in the text field. |
|
||||
| [Pt Rand](pt_rand.md) | Creates a PyTorch tensor with values sampled from a uniform distribution |
|
||||
| [Pt Rand Int](pt_rand_int.md) | Creates a PyTorch tensor filled with random integers within a specified range using the size entered in the text field. |
|
||||
| [Pt Randn](pt_randn.md) | Creates a PyTorch tensor with values sampled from a standard normal distribution (mean=0, std=1) |
|
||||
| [Pt Zeros](pt_zeros.md) | Creates a PyTorch tensor of zeros using the size entered in the text field. |
|
||||
## PyTorch wrapper - Tensor data conversion
|
||||
| Node | Description |
|
||||
| --- | --- |
|
||||
@@ -221,6 +227,13 @@
|
||||
| [Pt To Latent](pt_to_latent.md) | Casts a PyTorch tensor as a latent tensor. |
|
||||
| [Pt To Numpy](pt_to_numpy.md) | Converts PyTorch tensor to NumPy ndarray. |
|
||||
| [Pt To Rgb Tensors](pt_to_rgb_tensors.md) | Splits a PyTorch tensor into R, G, and B tensors. |
|
||||
## PyTorch wrapper - Transform
|
||||
| Node | Description |
|
||||
| --- | --- |
|
||||
| [Pt Permute](pt_permute.md) | Permutes the dimensions of a PyTorch tensor according to the specified order. |
|
||||
| [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()`. |
|
||||
## Python wrapper
|
||||
| Node | Description |
|
||||
| --- | --- |
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# Pt Full
|
||||
Creates a PyTorch tensor filled with a specified value using the size entered in the text field.
|
||||
For example, if you want to create a 4D tensor of batch size=2, channel=3, height=96, width=32 filled with 7, enter:
|
||||
[2,3,96,32] for size and 7 for value.
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| value | String |
|
||||
| size | String |
|
||||
| data_type | |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Tensor creation
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,20 @@
|
||||
# Pt Ones
|
||||
Creates a PyTorch tensor of ones using the size entered in the text field.
|
||||
For example, if you want to create a 4D tensor of batch size=2, channel=3, height=96, width=32, enter:
|
||||
[2,3,96,32]
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| size | String |
|
||||
| data_type | |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Tensor creation
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,25 @@
|
||||
# Pt Permute
|
||||
Permutes the dimensions of a PyTorch tensor according to the specified order.
|
||||
For example, if a tensor has shape (2, 3, 96, 32) and `new_axes="[0, 3, 1, 2]"`,
|
||||
the output will have shape (2, 32, 3, 96).
|
||||
|
||||
Specify the new axis order in the `new_axes` field using brackets, as shown below:
|
||||
```
|
||||
[0, 3, 1, 2]
|
||||
```
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| new_axes | 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,21 @@
|
||||
# Pt Rand
|
||||
Creates a PyTorch tensor with values sampled from a uniform distribution
|
||||
using the size entered in the text field.
|
||||
For example, if you want to create a 4D tensor of batch size=2, channel=3, height=96, width=32, enter:
|
||||
[2,3,96,32]
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| size | String |
|
||||
| data_type | |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Tensor creation
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,22 @@
|
||||
# Pt Rand Int
|
||||
Creates a PyTorch tensor filled with random integers within a specified range using the size entered in the text field.
|
||||
For example, if you want to create a 4D tensor of batch size=2, channel=3, height=96, width=32 with random integers in the range [0, 10),
|
||||
enter [2,3,96,32] for size, 0 for min_value, and 10 for max_value.
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| min_value | Int |
|
||||
| max_value | Int |
|
||||
| size | String |
|
||||
| data_type | |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Tensor creation
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,21 @@
|
||||
# Pt Randn
|
||||
Creates a PyTorch tensor with values sampled from a standard normal distribution (mean=0, std=1)
|
||||
using the size entered in the text field.
|
||||
For example, if you want to create a 4D tensor of batch size=2, channel=3, height=96, width=32, enter:
|
||||
[2,3,96,32]
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| size | String |
|
||||
| data_type | |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Tensor creation
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,20 @@
|
||||
# Pt Squeeze
|
||||
Removes a dimension at the specified position in the input tensor if it is of size 1.
|
||||
|
||||
Specifying a tuple of dimensions is not supported yet.
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| dim | Int |
|
||||
|
||||
## 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,19 @@
|
||||
# Pt Unsqueeze
|
||||
Adds a singleton dimension at the specified position in the input tensor.
|
||||
For example, if a tensor has shape (3, 4) and `dim=1`, the output will have shape (3, 1, 4).
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| dim | Int |
|
||||
|
||||
## 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,27 @@
|
||||
# Pt View
|
||||
Reshapes a PyTorch tensor into a specified shape using `torch.view()`.
|
||||
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,20 @@
|
||||
# Pt Zeros
|
||||
Creates a PyTorch tensor of zeros using the size entered in the text field.
|
||||
For example, if you want to create a 4D tensor of batch size=2, channel=3, height=96, width=32, enter:
|
||||
[2,3,96,32]
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| size | String |
|
||||
| data_type | |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Tensor creation
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
Reference in New Issue
Block a user