Added Pt To Image, Pt To Latent, Pt From Image, Pt To Image nodes.

This commit is contained in:
HowToSD
2025-02-24 23:11:05 -08:00
parent 174873e2ee
commit 8f00640ebe
11 changed files with 245 additions and 1 deletions
+12
View File
@@ -116,8 +116,12 @@ from .modules.pandas_wrapper.pandas_vertical_concat import PandasVerticalConcat
from .modules.pandas_wrapper.pandas_vertical_split import PandasVerticalSplit
from .modules.pandas_wrapper.pandas_xs import PandasXs
from .modules.pytorch_wrapper.pt_float_create import PtFloatCreate
from .modules.pytorch_wrapper.pt_from_image import PtFromImage
from .modules.pytorch_wrapper.pt_from_latent import PtFromLatent
from .modules.pytorch_wrapper.pt_from_numpy import PtFromNumpy
from .modules.pytorch_wrapper.pt_int_create import PtIntCreate
from .modules.pytorch_wrapper.pt_to_image import PtToImage
from .modules.pytorch_wrapper.pt_to_latent import PtToLatent
from .modules.pytorch_wrapper.pt_to_numpy import PtToNumpy
from .modules.seaborn_wrapper.sns_bar import SNSBar
from .modules.seaborn_wrapper.sns_histogram import SNSHistogram
@@ -245,8 +249,12 @@ NODE_CLASS_MAPPINGS: Dict[str, Type[T]] = {
"PandasVerticalSplit": PandasVerticalSplit,
"PandasXs": PandasXs,
"PtFloatCreate": PtFloatCreate,
"PtFromImage": PtFromImage,
"PtFromLatent": PtFromLatent,
"PtFromNumpy": PtFromNumpy,
"PtIntCreate": PtIntCreate,
"PtToImage": PtToImage,
"PtToLatent": PtToLatent,
"PtToNumpy": PtToNumpy,
"PyKvFloatCreate": PyKvFloatCreate,
"PyKvIntCreate": PyKvIntCreate,
@@ -377,8 +385,12 @@ NODE_DISPLAY_NAME_MAPPINGS: Dict[str, str] = {
"PandasVerticalSplit": "Pandas Vertical Split",
"PandasXs": "Pandas Xs",
"PtFloatCreate": "Pt Float Create",
"PtFromImage": "Pt From Image",
"PtFromLatent": "Pt From Latent",
"PtFromNumpy": "Pt From Numpy",
"PtIntCreate": "Pt Int Create",
"PtToImage": "Pt To Image",
"PtToLatent": "Pt To Latent",
"PtToNumpy": "Pt To Numpy",
"PyKvFloatCreate": "Py Kv Float Create",
"PyKvIntCreate": "Py Kv Int Create",
+4
View File
@@ -132,8 +132,12 @@
| Node | Description |
| --- | --- |
| [Pt Float Create](pt_float_create.md) | Creates a PyTorch tensor with 32-bit floating point precision |
| [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 Int Create](pt_int_create.md) | Creates a PyTorch tensor with 32-bit integer |
| [Pt To Image](pt_to_image.md) | Casts a PyTorch tensor as an Image tensor. |
| [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. |
## Python wrapper
| Node | Description |
+17
View File
@@ -0,0 +1,17 @@
# Pt From Image
Casts an Image tensor as a PyTorch tensor.
## Input
| Name | Data type |
|---|---|
| image | Image |
## Output
| Data type |
|---|
| Tensor |
<HR>
Category: PyTorch wrapper
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
+17
View File
@@ -0,0 +1,17 @@
# Pt From Latent
Casts a latent tensor as a PyTorch tensor.
## Input
| Name | Data type |
|---|---|
| latent | Latent |
## Output
| Data type |
|---|
| Tensor |
<HR>
Category: PyTorch wrapper
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
+17
View File
@@ -0,0 +1,17 @@
# Pt To Image
Casts a PyTorch tensor as an Image tensor.
## Input
| Name | Data type |
|---|---|
| tens | Tensor |
## Output
| Data type |
|---|
| Image |
<HR>
Category: PyTorch wrapper
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
+17
View File
@@ -0,0 +1,17 @@
# Pt To Latent
Casts a PyTorch tensor as a latent tensor.
## Input
| Name | Data type |
|---|---|
| tens | Tensor |
## Output
| Data type |
|---|
| Latent |
<HR>
Category: PyTorch wrapper
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
+40
View File
@@ -0,0 +1,40 @@
from typing import Any, Dict
import torch
class PtFromImage:
"""
Casts an Image tensor as a PyTorch tensor.
category: PyTorch wrapper
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, Any]:
"""
Defines the input types for the function.
Returns:
Dict[str, Any]: A dictionary specifying required input types.
"""
return {
"required": {
"image": ("IMAGE", {}),
}
}
RETURN_TYPES: tuple = ("TENSOR",)
FUNCTION: str = "f"
CATEGORY: str = "PyTorch wrapper"
def f(self, image: torch.Tensor) -> tuple:
"""
Casts an Image tensor as a PyTorch tensor.
Args:
image (torch.Tensor): Image tensor
Returns:
tuple: A tuple containing the PyTorch tensor.
"""
return (image,)
+40
View File
@@ -0,0 +1,40 @@
from typing import Any, Dict
import torch
class PtFromLatent:
"""
Casts a latent tensor as a PyTorch tensor.
category: PyTorch wrapper
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, Any]:
"""
Defines the input types for the function.
Returns:
Dict[str, Any]: A dictionary specifying required input types.
"""
return {
"required": {
"latent": ("LATENT", {}),
}
}
RETURN_TYPES: tuple = ("TENSOR",)
FUNCTION: str = "f"
CATEGORY: str = "PyTorch wrapper"
def f(self, latent: torch.Tensor) -> tuple:
"""
Casts a latent tensor as a PyTorch tensor.
Args:
latent (torch.Tensor): Latent tensor
Returns:
tuple: A tuple containing the PyTorch tensor.
"""
return (latent,)
+40
View File
@@ -0,0 +1,40 @@
from typing import Any, Dict
import torch
class PtToImage:
"""
Casts a PyTorch tensor as an Image tensor.
category: PyTorch wrapper
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, Any]:
"""
Defines the input types for the function.
Returns:
Dict[str, Any]: A dictionary specifying required input types.
"""
return {
"required": {
"tens": ("TENSOR", {}),
}
}
RETURN_TYPES: tuple = ("IMAGE",)
FUNCTION: str = "f"
CATEGORY: str = "PyTorch wrapper"
def f(self, tens: torch.Tensor) -> tuple:
"""
Casts a PyTorch tensor as an Image tensor.
Args:
tens (torch.Tensor): PyTorch Tensor
Returns:
tuple: A tuple containing the image tensor.
"""
return (tens,)
+40
View File
@@ -0,0 +1,40 @@
from typing import Any, Dict
import torch
class PtToLatent:
"""
Casts a PyTorch tensor as a latent tensor.
category: PyTorch wrapper
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, Any]:
"""
Defines the input types for the function.
Returns:
Dict[str, Any]: A dictionary specifying required input types.
"""
return {
"required": {
"tens": ("TENSOR", {}),
}
}
RETURN_TYPES: tuple = ("LATENT",)
FUNCTION: str = "f"
CATEGORY: str = "PyTorch wrapper"
def f(self, tens: torch.Tensor) -> tuple:
"""
Casts a PyTorch tensor as a latent tensor.
Args:
tens (torch.Tensor): PyTorch Tensor
Returns:
tuple: A tuple containing the latent tensor.
"""
return (tens,)
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "data-analysis"
description = "Data analysis custom modules for ComfyUI - Use Pandas & Matplotlib within ComfyUI"
version = "1.3.0"
version = "1.3.2"
license = {file = "LICENSE"}
[project.urls]