diff --git a/__init__.py b/__init__.py index 5bbc107..085535f 100644 --- a/__init__.py +++ b/__init__.py @@ -3,6 +3,7 @@ from typing import Dict, Type, TypeVar from .modules.pytorch_wrapper.pt_abs import PtAbs from .modules.pytorch_wrapper.pt_acos import PtAcos from .modules.pytorch_wrapper.pt_add import PtAdd +from .modules.pytorch_wrapper.pt_apply_function import PtApplyFunction from .modules.pytorch_wrapper.pt_arange import PtArange from .modules.pytorch_wrapper.pt_argmax import PtArgmax from .modules.pytorch_wrapper.pt_argmin import PtArgmin @@ -111,6 +112,16 @@ from .modules.pytorch_wrapper.pt_var import PtVar from .modules.pytorch_wrapper.pt_view import PtView from .modules.pytorch_wrapper.pt_where import PtWhere from .modules.pytorch_wrapper.pt_zeros import PtZeros +from .modules.pytorch_wrapper.ptf_gelu import PtfGELU +from .modules.pytorch_wrapper.ptf_leaky_relu import PtfLeakyReLU +from .modules.pytorch_wrapper.ptf_log_softmax import PtfLogSoftmax +from .modules.pytorch_wrapper.ptf_relu import PtfReLU +from .modules.pytorch_wrapper.ptf_sigmoid import PtfSigmoid +from .modules.pytorch_wrapper.ptf_silu import PtfSiLU +from .modules.pytorch_wrapper.ptf_softmax import PtfSoftmax +from .modules.pytorch_wrapper.ptf_softplus import PtfSoftplus +from .modules.pytorch_wrapper.ptf_tanh import PtfTanh +from .modules.pytorch_wrapper.ptn_chained_model import PtnChainedModel from .modules.pytorch_wrapper.ptn_conv_model import PtnConvModel from .modules.pytorch_wrapper.ptn_linear import PtnLinear from .modules.pytorch_wrapper.ptn_linear_model import PtnLinearModel @@ -139,6 +150,7 @@ NODE_CLASS_MAPPINGS: Dict[str, Type[T]] = { "PtAbs": PtAbs, "PtAcos": PtAcos, "PtAdd": PtAdd, + "PtApplyFunction": PtApplyFunction, "PtArange": PtArange, "PtArgmax": PtArgmax, "PtArgmin": PtArgmin, @@ -247,6 +259,16 @@ NODE_CLASS_MAPPINGS: Dict[str, Type[T]] = { "PtView": PtView, "PtWhere": PtWhere, "PtZeros": PtZeros, + "PtfGELU": PtfGELU, + "PtfLeakyReLU": PtfLeakyReLU, + "PtfLogSoftmax": PtfLogSoftmax, + "PtfReLU": PtfReLU, + "PtfSiLU": PtfSiLU, + "PtfSigmoid": PtfSigmoid, + "PtfSoftmax": PtfSoftmax, + "PtfSoftplus": PtfSoftplus, + "PtfTanh": PtfTanh, + "PtnChainedModel": PtnChainedModel, "PtnConvModel": PtnConvModel, "PtnLinear": PtnLinear, "PtnLinearModel": PtnLinearModel, @@ -275,6 +297,7 @@ NODE_DISPLAY_NAME_MAPPINGS: Dict[str, str] = { "PtAbs": "Pt Abs", "PtAcos": "Pt Acos", "PtAdd": "Pt Add", + "PtApplyFunction": "Pt Apply Function", "PtArange": "Pt Arange", "PtArgmax": "Pt Argmax", "PtArgmin": "Pt Argmin", @@ -383,6 +406,16 @@ NODE_DISPLAY_NAME_MAPPINGS: Dict[str, str] = { "PtView": "Pt View", "PtWhere": "Pt Where", "PtZeros": "Pt Zeros", + "PtfGELU": "Ptf GELU", + "PtfLeakyReLU": "Ptf Leaky ReLU", + "PtfLogSoftmax": "Ptf Log Softmax", + "PtfReLU": "Ptf ReLU", + "PtfSiLU": "Ptf SiLU", + "PtfSigmoid": "Ptf Sigmoid", + "PtfSoftmax": "Ptf Softmax", + "PtfSoftplus": "Ptf Softplus", + "PtfTanh": "Ptf Tanh", + "PtnChainedModel": "Ptn Chained Model", "PtnConvModel": "Ptn Conv Model", "PtnLinear": "Ptn Linear", "PtnLinearModel": "Ptn Linear Model", diff --git a/dev/scripts/init_py_generate.py b/dev/scripts/init_py_generate.py index 2d22740..c33315c 100644 --- a/dev/scripts/init_py_generate.py +++ b/dev/scripts/init_py_generate.py @@ -78,6 +78,9 @@ def format_display_name(class_name): ("MP L", "MPL"), ("SN S", "SNS"), (" N A", " NA"), + ("Re L U", "ReLU"), + ("Si L U", "SiLU"), + ("G E L U", "GELU"), ("Data Frame", "DataFrame"), ("Multi Index", "MultiIndex"), ("MPL Bar", "MPL Bar Chart"), diff --git a/dev/scripts/reference_generate.py b/dev/scripts/reference_generate.py index 134db7e..11f5f3f 100644 --- a/dev/scripts/reference_generate.py +++ b/dev/scripts/reference_generate.py @@ -125,7 +125,7 @@ def process_python_file(file_path: str, output_dir: str, node_list: Dict[str, Li md_file.write(output_section + "\n") md_file.write("
\n") md_file.write(f"Category: {category}\n\n") - md_file.write(f"ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.\n") + md_file.write(f"ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.\n") node_list[category].append((class_info['title'][2:], file_name, class_info['first_sentence'])) diff --git a/docs/reference/node_reference.md b/docs/reference/node_reference.md index d5ad1d2..2296e86 100644 --- a/docs/reference/node_reference.md +++ b/docs/reference/node_reference.md @@ -27,6 +27,18 @@ | [Pt Bitwise Or](pt_bitwise_or.md) | Performs a bitwise OR operation on two PyTorch tensors element-wise. | | [Pt Bitwise Right Shift](pt_bitwise_right_shift.md) | Performs a bitwise right shift operation on two PyTorch tensors element-wise. | | [Pt Bitwise Xor](pt_bitwise_xor.md) | Performs a bitwise XOR operation on two PyTorch tensors element-wise. | +## PyTorch wrapper - Callable +| Node | Description | +| --- | --- | +| [Ptf GELU](ptf_gelu.md) | | +| [Ptf LeakyReLU](ptf_leaky_relu.md) | | +| [Ptf Log Softmax](ptf_log_softmax.md) | A PyTorch wrapper for the log_softmax activation function. | +| [Ptf ReLU](ptf_relu.md) | | +| [Ptf SiLU](ptf_silu.md) | | +| [Ptf Sigmoid](ptf_sigmoid.md) | A PyTorch wrapper for the sigmoid activation function. | +| [Ptf Softmax](ptf_softmax.md) | A PyTorch wrapper for the softmax activation function. | +| [Ptf Softplus](ptf_softplus.md) | | +| [Ptf Tanh](ptf_tanh.md) | A PyTorch wrapper for the tanh activation function. | ## PyTorch wrapper - Comparison operations | Node | Description | | --- | --- | @@ -143,6 +155,7 @@ ## PyTorch wrapper - Training | Node | Description | | --- | --- | +| [Pt Apply Function](pt_apply_function.md) | Applies a function to the input tensor. | | [Pt Data Loader](pt_data_loader.md) | Loads data from a dataset node and creates a PyTorch DataLoader. | | [Pt Data Loader From Tensors](pt_data_loader_from_tensors.md) | Creates a Torchvision Dataloader from a pair of tensors. | | [Pt Evaluate Classification Model](pt_evaluate_classification_model.md) | Performs inference on test data and computes evaluation metrics. | diff --git a/docs/reference/pt_abs.md b/docs/reference/pt_abs.md index 2565442..3f9f86f 100644 --- a/docs/reference/pt_abs.md +++ b/docs/reference/pt_abs.md @@ -14,4 +14,4 @@ Computes the absolute value of each element in a PyTorch tensor.
Category: PyTorch wrapper - Math operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_acos.md b/docs/reference/pt_acos.md index 6df37ca..cdca5d0 100644 --- a/docs/reference/pt_acos.md +++ b/docs/reference/pt_acos.md @@ -14,4 +14,4 @@ Computes the arccosine (inverse cosine) of a PyTorch tensor element-wise.
Category: PyTorch wrapper - Math operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_add.md b/docs/reference/pt_add.md index 070bfd0..8cf0c11 100644 --- a/docs/reference/pt_add.md +++ b/docs/reference/pt_add.md @@ -15,4 +15,4 @@ Adds two PyTorch tensors.
Category: PyTorch wrapper - Arithmetic operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_apply_function.md b/docs/reference/pt_apply_function.md new file mode 100644 index 0000000..f9560e3 --- /dev/null +++ b/docs/reference/pt_apply_function.md @@ -0,0 +1,22 @@ +# Pt Apply Function +Applies a function to the input tensor. + +### Fields: +- tens: Tensor to which the function be applied. +- closure: Differentiable function to apply to the tensor. + +## Input +| Name | Data type | +|---|---| +| tens | Tensor | +| closure | Ptcallable | + +## Output +| Data type | +|---| +| Tensor | + +
+Category: PyTorch wrapper - Training + +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_arange.md b/docs/reference/pt_arange.md index 3a5e325..22d4905 100644 --- a/docs/reference/pt_arange.md +++ b/docs/reference/pt_arange.md @@ -20,4 +20,4 @@ tensor range values in text fields. The function also ensures proper dtype selec
Category: PyTorch wrapper - Tensor creation -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_argmax.md b/docs/reference/pt_argmax.md index 239bffc..e07fba4 100644 --- a/docs/reference/pt_argmax.md +++ b/docs/reference/pt_argmax.md @@ -21,4 +21,4 @@ Specify the dimension in the `dim` field using an integer as shown below:
Category: PyTorch wrapper - Reduction operation & Summary statistics -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_argmin.md b/docs/reference/pt_argmin.md index d08c285..757036d 100644 --- a/docs/reference/pt_argmin.md +++ b/docs/reference/pt_argmin.md @@ -21,4 +21,4 @@ Specify the dimension in the `dim` field using an integer as shown below:
Category: PyTorch wrapper - Reduction operation & Summary statistics -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_asin.md b/docs/reference/pt_asin.md index 8700137..ada7b84 100644 --- a/docs/reference/pt_asin.md +++ b/docs/reference/pt_asin.md @@ -14,4 +14,4 @@ Computes the arcsine (inverse sine) of a PyTorch tensor element-wise.
Category: PyTorch wrapper - Math operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_atan.md b/docs/reference/pt_atan.md index d745a09..4f34cac 100644 --- a/docs/reference/pt_atan.md +++ b/docs/reference/pt_atan.md @@ -14,4 +14,4 @@ Computes the arc tangent (inverse tangent) of a PyTorch tensor element-wise.
Category: PyTorch wrapper - Math operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_bitwise_and.md b/docs/reference/pt_bitwise_and.md index 3678455..8dc010c 100644 --- a/docs/reference/pt_bitwise_and.md +++ b/docs/reference/pt_bitwise_and.md @@ -15,4 +15,4 @@ Performs a bitwise AND operation on two PyTorch tensors element-wise.
Category: PyTorch wrapper - Bitwise operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_bitwise_left_shift.md b/docs/reference/pt_bitwise_left_shift.md index 17ef621..c366e4b 100644 --- a/docs/reference/pt_bitwise_left_shift.md +++ b/docs/reference/pt_bitwise_left_shift.md @@ -15,4 +15,4 @@ Performs a bitwise left shift operation on two PyTorch tensors element-wise.
Category: PyTorch wrapper - Bitwise operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_bitwise_not.md b/docs/reference/pt_bitwise_not.md index fd0080f..e8181db 100644 --- a/docs/reference/pt_bitwise_not.md +++ b/docs/reference/pt_bitwise_not.md @@ -14,4 +14,4 @@ Performs a bitwise NOT operation on a PyTorch tensor element-wise.
Category: PyTorch wrapper - Bitwise operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_bitwise_or.md b/docs/reference/pt_bitwise_or.md index 2bea79d..33b5c86 100644 --- a/docs/reference/pt_bitwise_or.md +++ b/docs/reference/pt_bitwise_or.md @@ -15,4 +15,4 @@ Performs a bitwise OR operation on two PyTorch tensors element-wise.
Category: PyTorch wrapper - Bitwise operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_bitwise_right_shift.md b/docs/reference/pt_bitwise_right_shift.md index b206a8f..f886552 100644 --- a/docs/reference/pt_bitwise_right_shift.md +++ b/docs/reference/pt_bitwise_right_shift.md @@ -15,4 +15,4 @@ Performs a bitwise right shift operation on two PyTorch tensors element-wise.
Category: PyTorch wrapper - Bitwise operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_bitwise_xor.md b/docs/reference/pt_bitwise_xor.md index 4074bb6..f3f4736 100644 --- a/docs/reference/pt_bitwise_xor.md +++ b/docs/reference/pt_bitwise_xor.md @@ -15,4 +15,4 @@ Performs a bitwise XOR operation on two PyTorch tensors element-wise.
Category: PyTorch wrapper - Bitwise operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_bmm.md b/docs/reference/pt_bmm.md index 151f974..8092923 100644 --- a/docs/reference/pt_bmm.md +++ b/docs/reference/pt_bmm.md @@ -15,4 +15,4 @@ Performs batched matrix multiplication on two 3D PyTorch tensors.
Category: PyTorch wrapper - Matrix operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_bool_create.md b/docs/reference/pt_bool_create.md index e342555..281d6f0 100644 --- a/docs/reference/pt_bool_create.md +++ b/docs/reference/pt_bool_create.md @@ -19,4 +19,4 @@ will create a 1D boolean tensor.
Category: PyTorch wrapper - Tensor creation -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_cos.md b/docs/reference/pt_cos.md index d180b87..775b207 100644 --- a/docs/reference/pt_cos.md +++ b/docs/reference/pt_cos.md @@ -14,4 +14,4 @@ Computes the cosine of a PyTorch tensor element-wise.
Category: PyTorch wrapper - Math operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_cosh.md b/docs/reference/pt_cosh.md index 9e3b309..8b7e93a 100644 --- a/docs/reference/pt_cosh.md +++ b/docs/reference/pt_cosh.md @@ -14,4 +14,4 @@ Computes the hyperbolic cosine of a PyTorch tensor element-wise.
Category: PyTorch wrapper - Math operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_crop.md b/docs/reference/pt_crop.md index 44ed92b..e7736f8 100644 --- a/docs/reference/pt_crop.md +++ b/docs/reference/pt_crop.md @@ -20,4 +20,4 @@ This transposition can be performed using the "Pt Permute" node with (0, 2, 3, 1
Category: PyTorch wrapper - Image processing -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_data_loader.md b/docs/reference/pt_data_loader.md index 2ae51c8..09cb50e 100644 --- a/docs/reference/pt_data_loader.md +++ b/docs/reference/pt_data_loader.md @@ -26,4 +26,4 @@ If True, shuffles the dataset before each epoch.
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_data_loader_from_tensors.md b/docs/reference/pt_data_loader_from_tensors.md index cb65e39..b2c23bd 100644 --- a/docs/reference/pt_data_loader_from_tensors.md +++ b/docs/reference/pt_data_loader_from_tensors.md @@ -25,4 +25,4 @@ Parameters
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_div.md b/docs/reference/pt_div.md index 585cdb7..ae3efad 100644 --- a/docs/reference/pt_div.md +++ b/docs/reference/pt_div.md @@ -15,4 +15,4 @@ Divides one PyTorch tensor by another element-wise.
Category: PyTorch wrapper - Arithmetic operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_einsum.md b/docs/reference/pt_einsum.md index fa1fcda..0dda5da 100644 --- a/docs/reference/pt_einsum.md +++ b/docs/reference/pt_einsum.md @@ -23,4 +23,4 @@ Sublist format is not supported.
Category: PyTorch wrapper - Matrix operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_eq.md b/docs/reference/pt_eq.md index 9228fa7..9e9c2b2 100644 --- a/docs/reference/pt_eq.md +++ b/docs/reference/pt_eq.md @@ -15,4 +15,4 @@ Tests whether two PyTorch tensors are equal element-wise.
Category: PyTorch wrapper - Comparison operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_evaluate_classification_model.md b/docs/reference/pt_evaluate_classification_model.md index c78bce9..1fc21f0 100644 --- a/docs/reference/pt_evaluate_classification_model.md +++ b/docs/reference/pt_evaluate_classification_model.md @@ -20,4 +20,4 @@ Performs inference on test data and computes evaluation metrics.
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_exp.md b/docs/reference/pt_exp.md index 8c4ffe0..9767671 100644 --- a/docs/reference/pt_exp.md +++ b/docs/reference/pt_exp.md @@ -14,4 +14,4 @@ Performs an exponential operation on a PyTorch tensor element-wise.
Category: PyTorch wrapper - Math operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_flatten.md b/docs/reference/pt_flatten.md index 9c32483..0712325 100644 --- a/docs/reference/pt_flatten.md +++ b/docs/reference/pt_flatten.md @@ -14,4 +14,4 @@ Flattens a PyTorch tensor into a 1D tensor.
Category: PyTorch wrapper - Transform -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_float_create.md b/docs/reference/pt_float_create.md index d84a389..4df40bf 100644 --- a/docs/reference/pt_float_create.md +++ b/docs/reference/pt_float_create.md @@ -15,4 +15,4 @@ using values entered in the text field.
Category: PyTorch wrapper - Tensor creation -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_floor_divide.md b/docs/reference/pt_floor_divide.md index 8f52b4f..81f7e5e 100644 --- a/docs/reference/pt_floor_divide.md +++ b/docs/reference/pt_floor_divide.md @@ -15,4 +15,4 @@ Performs element-wise floor division on two PyTorch tensors.
Category: PyTorch wrapper - Arithmetic operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_from_image.md b/docs/reference/pt_from_image.md index 75c6409..654e26c 100644 --- a/docs/reference/pt_from_image.md +++ b/docs/reference/pt_from_image.md @@ -14,4 +14,4 @@ Casts an Image tensor as a PyTorch tensor.
Category: PyTorch wrapper - Image processing -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_from_image_transpose.md b/docs/reference/pt_from_image_transpose.md index 767e5b9..54647e8 100644 --- a/docs/reference/pt_from_image_transpose.md +++ b/docs/reference/pt_from_image_transpose.md @@ -14,4 +14,4 @@ Casts an image tensor to a PyTorch tensor and transposes it from (H, W, C) to (C
Category: PyTorch wrapper - Image processing -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_from_latent.md b/docs/reference/pt_from_latent.md index 5ecb5b3..a721a47 100644 --- a/docs/reference/pt_from_latent.md +++ b/docs/reference/pt_from_latent.md @@ -14,4 +14,4 @@ Casts a latent tensor as a PyTorch tensor.
Category: PyTorch wrapper - Tensor creation -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_from_numpy.md b/docs/reference/pt_from_numpy.md index 105284d..bbc9c4a 100644 --- a/docs/reference/pt_from_numpy.md +++ b/docs/reference/pt_from_numpy.md @@ -14,4 +14,4 @@ Converts a NumPy ndarray to a PyTorch tensor while preserving its data type.
Category: PyTorch wrapper - Tensor creation -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_full.md b/docs/reference/pt_full.md index df0a41b..485aea0 100644 --- a/docs/reference/pt_full.md +++ b/docs/reference/pt_full.md @@ -18,4 +18,4 @@ For example, if you want to create a 4D tensor of batch size=2, channel=3, heigh
Category: PyTorch wrapper - Tensor creation -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_gather.md b/docs/reference/pt_gather.md index 9da9410..1ab1892 100644 --- a/docs/reference/pt_gather.md +++ b/docs/reference/pt_gather.md @@ -56,4 +56,4 @@ Let's analyze the case where `dim = 1`:
Category: PyTorch wrapper - Indexing and Slicing Operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_ge.md b/docs/reference/pt_ge.md index bd7b39c..dc52add 100644 --- a/docs/reference/pt_ge.md +++ b/docs/reference/pt_ge.md @@ -15,4 +15,4 @@ Tests whether elements in the first PyTorch tensor are greater than or equal to
Category: PyTorch wrapper - Comparison operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_gt.md b/docs/reference/pt_gt.md index 5401090..67470bb 100644 --- a/docs/reference/pt_gt.md +++ b/docs/reference/pt_gt.md @@ -15,4 +15,4 @@ Tests whether elements in the first PyTorch tensor are greater than the correspo
Category: PyTorch wrapper - Comparison operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_index_select.md b/docs/reference/pt_index_select.md index 09e6778..7126742 100644 --- a/docs/reference/pt_index_select.md +++ b/docs/reference/pt_index_select.md @@ -38,4 +38,4 @@ Output Tensor:
Category: PyTorch wrapper - Indexing and Slicing Operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_int_create.md b/docs/reference/pt_int_create.md index 9f3d826..20771a0 100644 --- a/docs/reference/pt_int_create.md +++ b/docs/reference/pt_int_create.md @@ -15,4 +15,4 @@ using values entered in the text field.
Category: PyTorch wrapper - Tensor creation -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_interpolate_by_scale_factor.md b/docs/reference/pt_interpolate_by_scale_factor.md index ec781ac..a2eb211 100644 --- a/docs/reference/pt_interpolate_by_scale_factor.md +++ b/docs/reference/pt_interpolate_by_scale_factor.md @@ -20,4 +20,4 @@ This transposition can be performed using the "Pt Permute" node with (0, 2, 3, 1
Category: PyTorch wrapper - Image processing -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_interpolate_to_size.md b/docs/reference/pt_interpolate_to_size.md index acec38d..7c74a22 100644 --- a/docs/reference/pt_interpolate_to_size.md +++ b/docs/reference/pt_interpolate_to_size.md @@ -21,4 +21,4 @@ This transposition can be performed using the "Pt Permute" node with (0, 2, 3, 1
Category: PyTorch wrapper - Image processing -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_le.md b/docs/reference/pt_le.md index aee74d2..eea918b 100644 --- a/docs/reference/pt_le.md +++ b/docs/reference/pt_le.md @@ -15,4 +15,4 @@ Tests whether elements in the first PyTorch tensor are less than or equal to the
Category: PyTorch wrapper - Comparison operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_linspace.md b/docs/reference/pt_linspace.md index df29f03..1e68504 100644 --- a/docs/reference/pt_linspace.md +++ b/docs/reference/pt_linspace.md @@ -20,4 +20,4 @@ The steps value is converted to an int.
Category: PyTorch wrapper - Tensor creation -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_load_model.md b/docs/reference/pt_load_model.md index 0466004..6fa8aa0 100644 --- a/docs/reference/pt_load_model.md +++ b/docs/reference/pt_load_model.md @@ -15,4 +15,4 @@ A wrapper class for saving a PyTorch model.
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_log.md b/docs/reference/pt_log.md index f15a101..5af6d21 100644 --- a/docs/reference/pt_log.md +++ b/docs/reference/pt_log.md @@ -14,4 +14,4 @@ Computes the natural logarithm (log base e) of a PyTorch tensor element-wise.
Category: PyTorch wrapper - Math operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_logical_and.md b/docs/reference/pt_logical_and.md index 10255b1..0b4f9a4 100644 --- a/docs/reference/pt_logical_and.md +++ b/docs/reference/pt_logical_and.md @@ -15,4 +15,4 @@ Performs a logical AND operation on two PyTorch tensors element-wise.
Category: PyTorch wrapper - Logical operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_logical_not.md b/docs/reference/pt_logical_not.md index 66616e3..fe0ca3c 100644 --- a/docs/reference/pt_logical_not.md +++ b/docs/reference/pt_logical_not.md @@ -14,4 +14,4 @@ Performs a logical NOT operation on a PyTorch tensor element-wise.
Category: PyTorch wrapper - Logical operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_logical_or.md b/docs/reference/pt_logical_or.md index 3519a38..b3b3b5b 100644 --- a/docs/reference/pt_logical_or.md +++ b/docs/reference/pt_logical_or.md @@ -15,4 +15,4 @@ Performs a logical OR operation on two PyTorch tensors element-wise.
Category: PyTorch wrapper - Logical operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_logical_xor.md b/docs/reference/pt_logical_xor.md index c67fe55..67579c7 100644 --- a/docs/reference/pt_logical_xor.md +++ b/docs/reference/pt_logical_xor.md @@ -15,4 +15,4 @@ Performs a logical XOR operation on two PyTorch tensors element-wise.
Category: PyTorch wrapper - Logical operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_lt.md b/docs/reference/pt_lt.md index b44c48b..adad732 100644 --- a/docs/reference/pt_lt.md +++ b/docs/reference/pt_lt.md @@ -15,4 +15,4 @@ Tests whether elements in the first PyTorch tensor are less than the correspondi
Category: PyTorch wrapper - Comparison operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_masked_select.md b/docs/reference/pt_masked_select.md index 80b9e15..5e48ae8 100644 --- a/docs/reference/pt_masked_select.md +++ b/docs/reference/pt_masked_select.md @@ -31,4 +31,4 @@ Output Tensor:
Category: PyTorch wrapper - Indexing and Slicing Operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_matmul.md b/docs/reference/pt_matmul.md index 8536132..c6957cd 100644 --- a/docs/reference/pt_matmul.md +++ b/docs/reference/pt_matmul.md @@ -15,4 +15,4 @@ Performs matrix multiplication on two PyTorch tensors.
Category: PyTorch wrapper - Matrix operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_max.md b/docs/reference/pt_max.md index 1f8b497..443cb95 100644 --- a/docs/reference/pt_max.md +++ b/docs/reference/pt_max.md @@ -21,4 +21,4 @@ Specify the dimension(s) in the `dim` field using an integer, a list, or a tuple
Category: PyTorch wrapper - Reduction operation & Summary statistics -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_mean.md b/docs/reference/pt_mean.md index e202099..fb053a8 100644 --- a/docs/reference/pt_mean.md +++ b/docs/reference/pt_mean.md @@ -23,4 +23,4 @@ Specify the dimension(s) in the `dim` field using an integer, a list, or a tuple
Category: PyTorch wrapper - Reduction operation & Summary statistics -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_median.md b/docs/reference/pt_median.md index 1d698d9..b316380 100644 --- a/docs/reference/pt_median.md +++ b/docs/reference/pt_median.md @@ -26,4 +26,4 @@ Note that PtMedian calls torch.median(), which returns the lower of the two numb
Category: PyTorch wrapper - Reduction operation & Summary statistics -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_min.md b/docs/reference/pt_min.md index f0dc408..ee06614 100644 --- a/docs/reference/pt_min.md +++ b/docs/reference/pt_min.md @@ -21,4 +21,4 @@ Specify the dimension(s) in the `dim` field using an integer, a list, or a tuple
Category: PyTorch wrapper - Reduction operation & Summary statistics -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_mm.md b/docs/reference/pt_mm.md index c6524b9..2d81ad0 100644 --- a/docs/reference/pt_mm.md +++ b/docs/reference/pt_mm.md @@ -15,4 +15,4 @@ Performs 2D matrix multiplication on two PyTorch tensors.
Category: PyTorch wrapper - Matrix operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_mul.md b/docs/reference/pt_mul.md index cda34b4..4770eb4 100644 --- a/docs/reference/pt_mul.md +++ b/docs/reference/pt_mul.md @@ -15,4 +15,4 @@ Multiplies two PyTorch tensors element-wise.
Category: PyTorch wrapper - Arithmetic operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_ne.md b/docs/reference/pt_ne.md index 37e88c7..e8a7369 100644 --- a/docs/reference/pt_ne.md +++ b/docs/reference/pt_ne.md @@ -15,4 +15,4 @@ Tests whether two PyTorch tensors are not equal element-wise.
Category: PyTorch wrapper - Comparison operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_neg.md b/docs/reference/pt_neg.md index 23d9114..2e3d41b 100644 --- a/docs/reference/pt_neg.md +++ b/docs/reference/pt_neg.md @@ -14,4 +14,4 @@ Computes the negation of each element in a PyTorch tensor.
Category: PyTorch wrapper - Math operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_ones.md b/docs/reference/pt_ones.md index 5f42dc7..a9792bd 100644 --- a/docs/reference/pt_ones.md +++ b/docs/reference/pt_ones.md @@ -17,4 +17,4 @@ For example, if you want to create a 4D tensor of batch size=2, channel=3, heigh
Category: PyTorch wrapper - Tensor creation -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_pad.md b/docs/reference/pt_pad.md index 2353f26..9fd3f65 100644 --- a/docs/reference/pt_pad.md +++ b/docs/reference/pt_pad.md @@ -20,4 +20,4 @@ This transposition can be performed using the "Pt Permute" node with (0, 2, 3, 1
Category: PyTorch wrapper - Image processing -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_permute.md b/docs/reference/pt_permute.md index 8fa187f..671f1d3 100644 --- a/docs/reference/pt_permute.md +++ b/docs/reference/pt_permute.md @@ -22,4 +22,4 @@ Specify the new axis order in the `new_axes` field using brackets, as shown belo
Category: PyTorch wrapper - Transform -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_pow.md b/docs/reference/pt_pow.md index 1d717bf..bb44f64 100644 --- a/docs/reference/pt_pow.md +++ b/docs/reference/pt_pow.md @@ -15,4 +15,4 @@ Raises one PyTorch tensor to the power of another element-wise.
Category: PyTorch wrapper - Arithmetic operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_predict_classification_model.md b/docs/reference/pt_predict_classification_model.md index 217f61a..fceedaa 100644 --- a/docs/reference/pt_predict_classification_model.md +++ b/docs/reference/pt_predict_classification_model.md @@ -19,4 +19,4 @@ Performs inference on input data.
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_predict_regression_model.md b/docs/reference/pt_predict_regression_model.md index 837c0cb..2c971b5 100644 --- a/docs/reference/pt_predict_regression_model.md +++ b/docs/reference/pt_predict_regression_model.md @@ -16,4 +16,4 @@ Performs inference on input data.
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_prod.md b/docs/reference/pt_prod.md index f7d2f37..3236d17 100644 --- a/docs/reference/pt_prod.md +++ b/docs/reference/pt_prod.md @@ -25,4 +25,4 @@ or
Category: PyTorch wrapper - Reduction operation & Summary statistics -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_rand.md b/docs/reference/pt_rand.md index 34ccd58..0a2ae18 100644 --- a/docs/reference/pt_rand.md +++ b/docs/reference/pt_rand.md @@ -18,4 +18,4 @@ For example, if you want to create a 4D tensor of batch size=2, channel=3, heigh
Category: PyTorch wrapper - Tensor creation -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_rand_int.md b/docs/reference/pt_rand_int.md index 16552cd..05c3ab0 100644 --- a/docs/reference/pt_rand_int.md +++ b/docs/reference/pt_rand_int.md @@ -19,4 +19,4 @@ enter [2,3,96,32] for size, 0 for min_value, and 10 for max_value.
Category: PyTorch wrapper - Tensor creation -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_randn.md b/docs/reference/pt_randn.md index 8c2057b..b750b18 100644 --- a/docs/reference/pt_randn.md +++ b/docs/reference/pt_randn.md @@ -18,4 +18,4 @@ For example, if you want to create a 4D tensor of batch size=2, channel=3, heigh
Category: PyTorch wrapper - Tensor creation -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_remainder.md b/docs/reference/pt_remainder.md index e4f68e6..9c0a16f 100644 --- a/docs/reference/pt_remainder.md +++ b/docs/reference/pt_remainder.md @@ -15,4 +15,4 @@ Computes the element-wise remainder of division between two PyTorch tensors.
Category: PyTorch wrapper - Arithmetic operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_reshape.md b/docs/reference/pt_reshape.md index fecad29..5e9a151 100644 --- a/docs/reference/pt_reshape.md +++ b/docs/reference/pt_reshape.md @@ -24,4 +24,4 @@ Use -1 to automatically infer a dimension, e.g.:
Category: PyTorch wrapper - Transform -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_save_model.md b/docs/reference/pt_save_model.md index da2d30c..f3f5317 100644 --- a/docs/reference/pt_save_model.md +++ b/docs/reference/pt_save_model.md @@ -15,4 +15,4 @@ A wrapper class for saving a PyTorch model.
Category: IO -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_scatter.md b/docs/reference/pt_scatter.md index 719ea0c..1354558 100644 --- a/docs/reference/pt_scatter.md +++ b/docs/reference/pt_scatter.md @@ -21,4 +21,4 @@ Generates a new tensor by replacing values at specified positions using an index
Category: PyTorch wrapper - Indexing and Slicing Operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_show_size.md b/docs/reference/pt_show_size.md index 8830fb1..b802bbb 100644 --- a/docs/reference/pt_show_size.md +++ b/docs/reference/pt_show_size.md @@ -14,4 +14,4 @@ Displays PyTorch Size object as a string.
Category: Display data -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_show_text.md b/docs/reference/pt_show_text.md index 40e397d..19e2fdb 100644 --- a/docs/reference/pt_show_text.md +++ b/docs/reference/pt_show_text.md @@ -15,4 +15,4 @@ the tensor contains more elements than the threshold set internally.
Category: Display data -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_sin.md b/docs/reference/pt_sin.md index 158065b..04b3d43 100644 --- a/docs/reference/pt_sin.md +++ b/docs/reference/pt_sin.md @@ -14,4 +14,4 @@ Computes the sine of a PyTorch tensor element-wise.
Category: PyTorch wrapper - Math operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_sinh.md b/docs/reference/pt_sinh.md index 755828f..5d303c9 100644 --- a/docs/reference/pt_sinh.md +++ b/docs/reference/pt_sinh.md @@ -14,4 +14,4 @@ Computes the hyperbolic sine of a PyTorch tensor element-wise.
Category: PyTorch wrapper - Math operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_size.md b/docs/reference/pt_size.md index a879754..bf34460 100644 --- a/docs/reference/pt_size.md +++ b/docs/reference/pt_size.md @@ -14,4 +14,4 @@ Extracts the PyTorch Size object of a PyTorch tensor using the size() method.
Category: PyTorch wrapper - Size object support -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_size_create.md b/docs/reference/pt_size_create.md index 8aee4ab..2f90e71 100644 --- a/docs/reference/pt_size_create.md +++ b/docs/reference/pt_size_create.md @@ -14,4 +14,4 @@ Creates a PyTorch Size using values entered in the text field.
Category: PyTorch wrapper - Size object support -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_size_to_numpy.md b/docs/reference/pt_size_to_numpy.md index 784063d..24b58b6 100644 --- a/docs/reference/pt_size_to_numpy.md +++ b/docs/reference/pt_size_to_numpy.md @@ -14,4 +14,4 @@ Converts PyTorch Size object to NumPy ndarray.
Category: PyTorch wrapper - Size object support -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_size_to_string.md b/docs/reference/pt_size_to_string.md index 2e94aaa..a03147b 100644 --- a/docs/reference/pt_size_to_string.md +++ b/docs/reference/pt_size_to_string.md @@ -14,4 +14,4 @@ Converts PyTorch Size object to a Python string.
Category: PyTorch wrapper - Size object support -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_sqrt.md b/docs/reference/pt_sqrt.md index 0b6165c..b7ca108 100644 --- a/docs/reference/pt_sqrt.md +++ b/docs/reference/pt_sqrt.md @@ -14,4 +14,4 @@ Computes the square root of each element in a PyTorch tensor.
Category: PyTorch wrapper - Math operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_squeeze.md b/docs/reference/pt_squeeze.md index b11c993..af5b10d 100644 --- a/docs/reference/pt_squeeze.md +++ b/docs/reference/pt_squeeze.md @@ -17,4 +17,4 @@ Specifying a tuple of dimensions is not supported yet.
Category: PyTorch wrapper - Transform -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_std.md b/docs/reference/pt_std.md index 16ebc9b..1b7de2a 100644 --- a/docs/reference/pt_std.md +++ b/docs/reference/pt_std.md @@ -25,4 +25,4 @@ Specify the dimension(s) in the `dim` field using an integer, a list, or a tuple
Category: PyTorch wrapper - Reduction operation & Summary statistics -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_sub.md b/docs/reference/pt_sub.md index 827a938..5dadb64 100644 --- a/docs/reference/pt_sub.md +++ b/docs/reference/pt_sub.md @@ -15,4 +15,4 @@ Subtracts one PyTorch tensor from another.
Category: PyTorch wrapper - Arithmetic operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_sum.md b/docs/reference/pt_sum.md index 99608c8..b79f4b2 100644 --- a/docs/reference/pt_sum.md +++ b/docs/reference/pt_sum.md @@ -21,4 +21,4 @@ Specify the dimension(s) in the `dim` field using an integer, a list, or a tuple
Category: PyTorch wrapper - Reduction operation & Summary statistics -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_tan.md b/docs/reference/pt_tan.md index a05b3a5..7d81f40 100644 --- a/docs/reference/pt_tan.md +++ b/docs/reference/pt_tan.md @@ -14,4 +14,4 @@ Computes the tangent of a PyTorch tensor element-wise.
Category: PyTorch wrapper - Math operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_tanh.md b/docs/reference/pt_tanh.md index eff2b90..652c002 100644 --- a/docs/reference/pt_tanh.md +++ b/docs/reference/pt_tanh.md @@ -14,4 +14,4 @@ Computes the hyperbolic tangent of a PyTorch tensor element-wise.
Category: PyTorch wrapper - Math operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_to_bfloat16.md b/docs/reference/pt_to_bfloat16.md index d1d6413..31ff163 100644 --- a/docs/reference/pt_to_bfloat16.md +++ b/docs/reference/pt_to_bfloat16.md @@ -14,4 +14,4 @@ Converts the input tensor's data type to bfloat16.
Category: PyTorch wrapper - Data type conversion -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_to_float16.md b/docs/reference/pt_to_float16.md index 315da17..2a18a20 100644 --- a/docs/reference/pt_to_float16.md +++ b/docs/reference/pt_to_float16.md @@ -14,4 +14,4 @@ Converts the input tensor's data type to float16.
Category: PyTorch wrapper - Data type conversion -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_to_float32.md b/docs/reference/pt_to_float32.md index 775bd63..fdf9f64 100644 --- a/docs/reference/pt_to_float32.md +++ b/docs/reference/pt_to_float32.md @@ -14,4 +14,4 @@ Converts the input tensor's data type to float32.
Category: PyTorch wrapper - Data type conversion -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_to_float64.md b/docs/reference/pt_to_float64.md index bb15e56..15ebfe5 100644 --- a/docs/reference/pt_to_float64.md +++ b/docs/reference/pt_to_float64.md @@ -14,4 +14,4 @@ Converts the input tensor's data type to float64.
Category: PyTorch wrapper - Data type conversion -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_to_image.md b/docs/reference/pt_to_image.md index a5f86e8..6bb3afd 100644 --- a/docs/reference/pt_to_image.md +++ b/docs/reference/pt_to_image.md @@ -14,4 +14,4 @@ Casts a PyTorch tensor as an Image tensor.
Category: PyTorch wrapper - Image processing -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_to_image_transpose.md b/docs/reference/pt_to_image_transpose.md index 21af352..8288e91 100644 --- a/docs/reference/pt_to_image_transpose.md +++ b/docs/reference/pt_to_image_transpose.md @@ -14,4 +14,4 @@ Casts a PyTorch tensor as an Image tensor and transposes it from (C, H, W) to (H
Category: PyTorch wrapper - Image processing -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_to_int16.md b/docs/reference/pt_to_int16.md index b0a4b3e..54ded7b 100644 --- a/docs/reference/pt_to_int16.md +++ b/docs/reference/pt_to_int16.md @@ -14,4 +14,4 @@ Converts the input tensor's data type to int16.
Category: PyTorch wrapper - Data type conversion -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_to_int32.md b/docs/reference/pt_to_int32.md index 8c9321e..4eb5db7 100644 --- a/docs/reference/pt_to_int32.md +++ b/docs/reference/pt_to_int32.md @@ -14,4 +14,4 @@ Converts the input tensor's data type to int32.
Category: PyTorch wrapper - Data type conversion -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_to_int64.md b/docs/reference/pt_to_int64.md index f72a206..b7ed77d 100644 --- a/docs/reference/pt_to_int64.md +++ b/docs/reference/pt_to_int64.md @@ -14,4 +14,4 @@ Converts the input tensor's data type to int64.
Category: PyTorch wrapper - Data type conversion -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_to_int8.md b/docs/reference/pt_to_int8.md index b8c490a..71d712f 100644 --- a/docs/reference/pt_to_int8.md +++ b/docs/reference/pt_to_int8.md @@ -14,4 +14,4 @@ Converts the input tensor's data type to int8.
Category: PyTorch wrapper - Data type conversion -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_to_latent.md b/docs/reference/pt_to_latent.md index 9a1278c..f7aa274 100644 --- a/docs/reference/pt_to_latent.md +++ b/docs/reference/pt_to_latent.md @@ -14,4 +14,4 @@ Casts a PyTorch tensor as a latent tensor.
Category: PyTorch wrapper - Tensor data conversion -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_to_numpy.md b/docs/reference/pt_to_numpy.md index 47821d3..7a4ac87 100644 --- a/docs/reference/pt_to_numpy.md +++ b/docs/reference/pt_to_numpy.md @@ -14,4 +14,4 @@ Converts PyTorch tensor to NumPy ndarray.
Category: PyTorch wrapper - Tensor data conversion -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_to_rgb_tensors.md b/docs/reference/pt_to_rgb_tensors.md index aff0b37..9de82b1 100644 --- a/docs/reference/pt_to_rgb_tensors.md +++ b/docs/reference/pt_to_rgb_tensors.md @@ -16,4 +16,4 @@ Splits a PyTorch tensor into R, G, and B tensors.
Category: PyTorch wrapper - Tensor data conversion -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_to_uint8.md b/docs/reference/pt_to_uint8.md index c5a74f3..9395a63 100644 --- a/docs/reference/pt_to_uint8.md +++ b/docs/reference/pt_to_uint8.md @@ -14,4 +14,4 @@ Converts the input tensor's data type to uint8.
Category: PyTorch wrapper - Data type conversion -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_train_classification_model.md b/docs/reference/pt_train_classification_model.md index 061a2c4..f245195 100644 --- a/docs/reference/pt_train_classification_model.md +++ b/docs/reference/pt_train_classification_model.md @@ -27,4 +27,4 @@ output_best_val_model: Whether to outputs the model with the best val loss or th
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_train_classification_model_lr.md b/docs/reference/pt_train_classification_model_lr.md index a2e9d61..1e28587 100644 --- a/docs/reference/pt_train_classification_model_lr.md +++ b/docs/reference/pt_train_classification_model_lr.md @@ -28,4 +28,4 @@ output_best_val_model: Whether to outputs the model with the best val loss or th
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_train_regression_model.md b/docs/reference/pt_train_regression_model.md index 3307430..9538a65 100644 --- a/docs/reference/pt_train_regression_model.md +++ b/docs/reference/pt_train_regression_model.md @@ -27,4 +27,4 @@ output_best_val_model: Whether to outputs the model with the best val loss or th
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_unsqueeze.md b/docs/reference/pt_unsqueeze.md index 96bc5b1..780cc46 100644 --- a/docs/reference/pt_unsqueeze.md +++ b/docs/reference/pt_unsqueeze.md @@ -16,4 +16,4 @@ For example, if a tensor has shape (3, 4) and `dim=1`, the output will have shap
Category: PyTorch wrapper - Transform -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_var.md b/docs/reference/pt_var.md index 383af73..b262415 100644 --- a/docs/reference/pt_var.md +++ b/docs/reference/pt_var.md @@ -25,4 +25,4 @@ Specify the dimension(s) in the `dim` field using an integer, a list, or a tuple
Category: PyTorch wrapper - Reduction operation & Summary statistics -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_view.md b/docs/reference/pt_view.md index d366f3e..7a1928d 100644 --- a/docs/reference/pt_view.md +++ b/docs/reference/pt_view.md @@ -24,4 +24,4 @@ Use -1 to automatically infer a dimension, e.g.:
Category: PyTorch wrapper - Transform -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_where.md b/docs/reference/pt_where.md index b10ead9..5f548d5 100644 --- a/docs/reference/pt_where.md +++ b/docs/reference/pt_where.md @@ -20,4 +20,4 @@ Generates a new tensor by selecting values based on a condition tensor.
Category: PyTorch wrapper - Indexing and Slicing Operations -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pt_zeros.md b/docs/reference/pt_zeros.md index 7019740..9a7b55d 100644 --- a/docs/reference/pt_zeros.md +++ b/docs/reference/pt_zeros.md @@ -17,4 +17,4 @@ For example, if you want to create a 4D tensor of batch size=2, channel=3, heigh
Category: PyTorch wrapper - Tensor creation -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptf_gelu.md b/docs/reference/ptf_gelu.md new file mode 100644 index 0000000..72b8e39 --- /dev/null +++ b/docs/reference/ptf_gelu.md @@ -0,0 +1,15 @@ +# Ptf GELU +A PyTorch wrapper for the GELU activation function. + +This class provides a callable that applies the GELU activation function +from `torch.nn.functional`. + +## Output +| Data type | +|---| +| Ptcallable | + +
+Category: PyTorch wrapper - Callable + +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptf_leaky_relu.md b/docs/reference/ptf_leaky_relu.md new file mode 100644 index 0000000..d33c7f7 --- /dev/null +++ b/docs/reference/ptf_leaky_relu.md @@ -0,0 +1,20 @@ +# Ptf LeakyReLU +A PyTorch wrapper for the LeakyReLU activation function. + +This class provides a callable that applies the LeakyReLU activation function +from `torch.nn.functional`. + +## Input +| Name | Data type | +|---|---| +| negative_slope | Float | + +## Output +| Data type | +|---| +| Ptcallable | + +
+Category: PyTorch wrapper - Callable + +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptf_log_softmax.md b/docs/reference/ptf_log_softmax.md new file mode 100644 index 0000000..8f5fa6c --- /dev/null +++ b/docs/reference/ptf_log_softmax.md @@ -0,0 +1,15 @@ +# Ptf Log Softmax +A PyTorch wrapper for the log_softmax activation function. + +This class provides a callable that applies the log_softmax activation function +from `torch.nn.functional`. + +## Output +| Data type | +|---| +| Ptcallable | + +
+Category: PyTorch wrapper - Callable + +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptf_relu.md b/docs/reference/ptf_relu.md new file mode 100644 index 0000000..b5886b9 --- /dev/null +++ b/docs/reference/ptf_relu.md @@ -0,0 +1,15 @@ +# Ptf ReLU +A PyTorch wrapper for the ReLU activation function. + +This class provides a callable that applies the ReLU activation function +from `torch.nn.functional`. + +## Output +| Data type | +|---| +| Ptcallable | + +
+Category: PyTorch wrapper - Callable + +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptf_sigmoid.md b/docs/reference/ptf_sigmoid.md new file mode 100644 index 0000000..c9de591 --- /dev/null +++ b/docs/reference/ptf_sigmoid.md @@ -0,0 +1,15 @@ +# Ptf Sigmoid +A PyTorch wrapper for the sigmoid activation function. + +This class provides a callable that applies the sigmoid activation function +from `torch.nn.functional`. + +## Output +| Data type | +|---| +| Ptcallable | + +
+Category: PyTorch wrapper - Callable + +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptf_silu.md b/docs/reference/ptf_silu.md new file mode 100644 index 0000000..e3e9343 --- /dev/null +++ b/docs/reference/ptf_silu.md @@ -0,0 +1,15 @@ +# Ptf SiLU +A PyTorch wrapper for the SiLU activation function. + +This class provides a callable that applies the SiLU activation function +from `torch.nn.functional`. + +## Output +| Data type | +|---| +| Ptcallable | + +
+Category: PyTorch wrapper - Callable + +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptf_softmax.md b/docs/reference/ptf_softmax.md new file mode 100644 index 0000000..6d651c5 --- /dev/null +++ b/docs/reference/ptf_softmax.md @@ -0,0 +1,18 @@ +# Ptf Softmax +A PyTorch wrapper for the softmax activation function. + +This class provides a callable that applies the softmax activation function +from `torch.nn.functional`. + +Internally, this node calls torch.nn.functional.softmax(dim=-1). +See https://github.com/pytorch/pytorch/issues/1020 to find out more about the meaning of dim. + +## Output +| Data type | +|---| +| Ptcallable | + +
+Category: PyTorch wrapper - Callable + +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptf_softplus.md b/docs/reference/ptf_softplus.md new file mode 100644 index 0000000..b2d00ab --- /dev/null +++ b/docs/reference/ptf_softplus.md @@ -0,0 +1,15 @@ +# Ptf Softplus +A PyTorch wrapper for the Softplus activation function. + +This class provides a callable that applies the Softplus activation function +from `torch.nn.functional`. + +## Output +| Data type | +|---| +| Ptcallable | + +
+Category: PyTorch wrapper - Callable + +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptf_tanh.md b/docs/reference/ptf_tanh.md new file mode 100644 index 0000000..def3af3 --- /dev/null +++ b/docs/reference/ptf_tanh.md @@ -0,0 +1,15 @@ +# Ptf Tanh +A PyTorch wrapper for the tanh activation function. + +This class provides a callable that applies the tanh activation function +from `torch.nn.functional`. + +## Output +| Data type | +|---| +| Ptcallable | + +
+Category: PyTorch wrapper - Callable + +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptn_conv_model.md b/docs/reference/ptn_conv_model.md index d881ea0..44687ae 100644 --- a/docs/reference/ptn_conv_model.md +++ b/docs/reference/ptn_conv_model.md @@ -42,4 +42,4 @@ A convolutional model consisting of multiple convolutional layers.
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptn_linear.md b/docs/reference/ptn_linear.md index 07bcb2d..2f43cd2 100644 --- a/docs/reference/ptn_linear.md +++ b/docs/reference/ptn_linear.md @@ -21,4 +21,4 @@ A linear model consisting of a single dense layer.
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptn_linear_model.md b/docs/reference/ptn_linear_model.md index a9788fa..f043c93 100644 --- a/docs/reference/ptn_linear_model.md +++ b/docs/reference/ptn_linear_model.md @@ -32,4 +32,4 @@ A linear model consisting of dense layers.
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptn_resnet_model.md b/docs/reference/ptn_resnet_model.md index 25e0a84..6ac65c9 100644 --- a/docs/reference/ptn_resnet_model.md +++ b/docs/reference/ptn_resnet_model.md @@ -25,4 +25,4 @@ A Resnet model consisting of multiple Resnet layers.
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pto_adam.md b/docs/reference/pto_adam.md index 257420e..eab0510 100644 --- a/docs/reference/pto_adam.md +++ b/docs/reference/pto_adam.md @@ -17,4 +17,4 @@ Instantiates the Adam optimizer.
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pto_lr_scheduler_cosine_annealing.md b/docs/reference/pto_lr_scheduler_cosine_annealing.md index 764b260..5b4bbad 100644 --- a/docs/reference/pto_lr_scheduler_cosine_annealing.md +++ b/docs/reference/pto_lr_scheduler_cosine_annealing.md @@ -46,4 +46,4 @@ Parameters
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pto_lr_scheduler_reduce_on_plateau.md b/docs/reference/pto_lr_scheduler_reduce_on_plateau.md index 7d0e49f..25269dd 100644 --- a/docs/reference/pto_lr_scheduler_reduce_on_plateau.md +++ b/docs/reference/pto_lr_scheduler_reduce_on_plateau.md @@ -27,4 +27,4 @@ Parameters
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/pto_lr_scheduler_step.md b/docs/reference/pto_lr_scheduler_step.md index f1eebfc..106fbb7 100644 --- a/docs/reference/pto_lr_scheduler_step.md +++ b/docs/reference/pto_lr_scheduler_step.md @@ -27,4 +27,4 @@ Parameters
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptv_dataset.md b/docs/reference/ptv_dataset.md index 1258c76..9da7cd0 100644 --- a/docs/reference/ptv_dataset.md +++ b/docs/reference/ptv_dataset.md @@ -48,4 +48,4 @@ Parameters
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptv_dataset_len.md b/docs/reference/ptv_dataset_len.md index 47ca57a..3ed5e18 100644 --- a/docs/reference/ptv_dataset_len.md +++ b/docs/reference/ptv_dataset_len.md @@ -14,4 +14,4 @@ A wrapper class that calls Python len on a dataset.
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptv_dataset_loader.md b/docs/reference/ptv_dataset_loader.md index ee13ac5..d484cbd 100644 --- a/docs/reference/ptv_dataset_loader.md +++ b/docs/reference/ptv_dataset_loader.md @@ -57,4 +57,4 @@ Parameters
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptv_image_folder_dataset.md b/docs/reference/ptv_image_folder_dataset.md index b973b55..a4b4420 100644 --- a/docs/reference/ptv_image_folder_dataset.md +++ b/docs/reference/ptv_image_folder_dataset.md @@ -25,4 +25,4 @@ Parameters
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptv_transforms_data_augment.md b/docs/reference/ptv_transforms_data_augment.md index 12dc527..a0bfccd 100644 --- a/docs/reference/ptv_transforms_data_augment.md +++ b/docs/reference/ptv_transforms_data_augment.md @@ -21,4 +21,4 @@ Supported transformations include flipping, rotation, translation, and scaling.
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptv_transforms_resize.md b/docs/reference/ptv_transforms_resize.md index 159626f..eac83b9 100644 --- a/docs/reference/ptv_transforms_resize.md +++ b/docs/reference/ptv_transforms_resize.md @@ -15,4 +15,4 @@ Resizes and transforms elements of dataset to PyTorch tensors.
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/docs/reference/ptv_transforms_to_tensor.md b/docs/reference/ptv_transforms_to_tensor.md index e1ca095..d6a59c0 100644 --- a/docs/reference/ptv_transforms_to_tensor.md +++ b/docs/reference/ptv_transforms_to_tensor.md @@ -9,4 +9,4 @@ Transforms elements of dataset to PyTorch tensors.
Category: PyTorch wrapper - Training -ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. +ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved. diff --git a/modules/pytorch_wrapper/pt_apply_function.py b/modules/pytorch_wrapper/pt_apply_function.py new file mode 100644 index 0000000..e48f6de --- /dev/null +++ b/modules/pytorch_wrapper/pt_apply_function.py @@ -0,0 +1,48 @@ +from typing import Any, Dict, Tuple, Callable +import torch + + +class PtApplyFunction: + """ + Applies a function to the input tensor. + + ### Fields: + - tens: Tensor to which the function be applied. + - closure: Differentiable function to apply to the tensor. + + category: PyTorch wrapper - Training + """ + + @classmethod + def INPUT_TYPES(cls) -> Dict[str, Any]: + """ + Defines the expected input types. + + Returns: + Dict[str, Any]: A dictionary specifying required and optional input types. + """ + return { + "required": { + "tens": ("TENSOR", {}), + "closure": ("PTCALLABLE", {}) + } + } + + RETURN_TYPES: Tuple[str, ...] = ("TENSOR",) + FUNCTION: str = "f" + CATEGORY: str = "Training" + + def f(self, + tens: torch.Tensor, + closure: Callable) -> Tuple[torch.Tensor]: + """ + Applies a function to the input tensor. + + Args: + tens (torch.Tensor): Tensor to which the function be applied. + closure (Callable): Differentiable function to apply to the tensor. + + Returns: + Tuple[nn.Module]: A tuple containing the instantiated model. + """ + return (closure(tens),) diff --git a/modules/pytorch_wrapper/ptf_gelu.py b/modules/pytorch_wrapper/ptf_gelu.py new file mode 100644 index 0000000..5eafef3 --- /dev/null +++ b/modules/pytorch_wrapper/ptf_gelu.py @@ -0,0 +1,38 @@ +from typing import Any, Dict, Callable, Tuple +import torch.nn.functional + + +class PtfGELU: + """ + Ptf GELU: + + A PyTorch wrapper for the GELU activation function. + + This class provides a callable that applies the GELU activation function + from `torch.nn.functional`. + + category: PyTorch wrapper - Callable + """ + + @classmethod + def INPUT_TYPES(cls) -> Dict[str, Any]: + """ + Defines the required input types. + + Returns: + Dict[str, Any]: An empty dictionary since this function requires no inputs. + """ + return {} + + RETURN_TYPES: Tuple[str, ...] = ("PTCALLABLE",) + FUNCTION: str = "f" + CATEGORY: str = "Data Analysis" + + def f(self) -> Tuple[Callable]: + """ + Returns the PyTorch GELU function as a callable. + + Returns: + Tuple[Callable]: A tuple containing `torch.nn.functional.silu`. + """ + return (torch.nn.functional.gelu,) diff --git a/modules/pytorch_wrapper/ptf_leaky_relu.py b/modules/pytorch_wrapper/ptf_leaky_relu.py new file mode 100644 index 0000000..8197c9f --- /dev/null +++ b/modules/pytorch_wrapper/ptf_leaky_relu.py @@ -0,0 +1,47 @@ +from typing import Any, Dict, Callable, Tuple +import torch.nn.functional + +import functools + +class PtfLeakyReLU: + """ + Ptf LeakyReLU: + + A PyTorch wrapper for the LeakyReLU activation function. + + This class provides a callable that applies the LeakyReLU activation function + from `torch.nn.functional`. + + category: PyTorch wrapper - Callable + """ + + @classmethod + def INPUT_TYPES(cls) -> Dict[str, Any]: + """ + Defines the required input types. + + Returns: + Dict[str, Any]: An empty dictionary since this function requires no inputs. + """ + return { + "required": { + "negative_slope": ("FLOAT", {"default": 0.01, "min": 1e-6, "max": 1e4, "step": 1e-5}), + } + } + + RETURN_TYPES: Tuple[str, ...] = ("PTCALLABLE",) + FUNCTION: str = "f" + CATEGORY: str = "Data Analysis" + + def f(self, negative_slope: float) -> Tuple[Callable]: + """ + Returns the PyTorch LeakyReLU function as a callable. + + Args: + negative_slope (float): The multiplier for the negative input. + Returns: + Tuple[Callable]: A tuple containing `torch.nn.functional.leaky_relu`. + """ + leaky_relu_last_axis = functools.partial(torch.nn.functional.leaky_relu, negative_slope=negative_slope) + + return (leaky_relu_last_axis,) diff --git a/modules/pytorch_wrapper/ptf_log_softmax.py b/modules/pytorch_wrapper/ptf_log_softmax.py new file mode 100644 index 0000000..678f31d --- /dev/null +++ b/modules/pytorch_wrapper/ptf_log_softmax.py @@ -0,0 +1,39 @@ +from typing import Any, Dict, Callable, Tuple +import torch +import torch.nn.functional +import functools + +log_softmax_last_axis = functools.partial(torch.nn.functional.log_softmax, dim=-1) + +class PtfLogSoftmax: + """ + A PyTorch wrapper for the log_softmax activation function. + + This class provides a callable that applies the log_softmax activation function + from `torch.nn.functional`. + + category: PyTorch wrapper - Callable + """ + + @classmethod + def INPUT_TYPES(cls) -> Dict[str, Any]: + """ + Defines the required input types. + + Returns: + Dict[str, Any]: An empty dictionary since this function requires no inputs. + """ + return {} + + RETURN_TYPES: Tuple[str, ...] = ("PTCALLABLE",) + FUNCTION: str = "f" + CATEGORY: str = "Data Analysis" + + def f(self) -> Tuple[Callable]: + """ + Returns the PyTorch log_softmax function as a callable. + + Returns: + Tuple[Callable]: A tuple containing `logsoftmax_last_axis`. + """ + return (log_softmax_last_axis,) diff --git a/modules/pytorch_wrapper/ptf_relu.py b/modules/pytorch_wrapper/ptf_relu.py new file mode 100644 index 0000000..cda7930 --- /dev/null +++ b/modules/pytorch_wrapper/ptf_relu.py @@ -0,0 +1,38 @@ +from typing import Any, Dict, Callable, Tuple +import torch.nn.functional + + +class PtfReLU: + """ + Ptf ReLU: + + A PyTorch wrapper for the ReLU activation function. + + This class provides a callable that applies the ReLU activation function + from `torch.nn.functional`. + + category: PyTorch wrapper - Callable + """ + + @classmethod + def INPUT_TYPES(cls) -> Dict[str, Any]: + """ + Defines the required input types. + + Returns: + Dict[str, Any]: An empty dictionary since this function requires no inputs. + """ + return {} + + RETURN_TYPES: Tuple[str, ...] = ("PTCALLABLE",) + FUNCTION: str = "f" + CATEGORY: str = "Data Analysis" + + def f(self) -> Tuple[Callable]: + """ + Returns the PyTorch ReLU function as a callable. + + Returns: + Tuple[Callable]: A tuple containing `torch.nn.functional.relu`. + """ + return (torch.nn.functional.relu,) diff --git a/modules/pytorch_wrapper/ptf_sigmoid.py b/modules/pytorch_wrapper/ptf_sigmoid.py new file mode 100644 index 0000000..6076475 --- /dev/null +++ b/modules/pytorch_wrapper/ptf_sigmoid.py @@ -0,0 +1,36 @@ +from typing import Any, Dict, Callable, Tuple +import torch.nn.functional + + +class PtfSigmoid: + """ + A PyTorch wrapper for the sigmoid activation function. + + This class provides a callable that applies the sigmoid activation function + from `torch.nn.functional`. + + category: PyTorch wrapper - Callable + """ + + @classmethod + def INPUT_TYPES(cls) -> Dict[str, Any]: + """ + Defines the required input types. + + Returns: + Dict[str, Any]: An empty dictionary since this function requires no inputs. + """ + return {} + + RETURN_TYPES: Tuple[str, ...] = ("PTCALLABLE",) + FUNCTION: str = "f" + CATEGORY: str = "Data Analysis" + + def f(self) -> Tuple[Callable]: + """ + Returns the PyTorch sigmoid function as a callable. + + Returns: + Tuple[Callable]: A tuple containing `torch.nn.functional.relu`. + """ + return (torch.nn.functional.sigmoid,) diff --git a/modules/pytorch_wrapper/ptf_silu.py b/modules/pytorch_wrapper/ptf_silu.py new file mode 100644 index 0000000..e13f8da --- /dev/null +++ b/modules/pytorch_wrapper/ptf_silu.py @@ -0,0 +1,38 @@ +from typing import Any, Dict, Callable, Tuple +import torch.nn.functional + + +class PtfSiLU: + """ + Ptf SiLU: + + A PyTorch wrapper for the SiLU activation function. + + This class provides a callable that applies the SiLU activation function + from `torch.nn.functional`. + + category: PyTorch wrapper - Callable + """ + + @classmethod + def INPUT_TYPES(cls) -> Dict[str, Any]: + """ + Defines the required input types. + + Returns: + Dict[str, Any]: An empty dictionary since this function requires no inputs. + """ + return {} + + RETURN_TYPES: Tuple[str, ...] = ("PTCALLABLE",) + FUNCTION: str = "f" + CATEGORY: str = "Data Analysis" + + def f(self) -> Tuple[Callable]: + """ + Returns the PyTorch SiLU function as a callable. + + Returns: + Tuple[Callable]: A tuple containing `torch.nn.functional.silu`. + """ + return (torch.nn.functional.silu,) diff --git a/modules/pytorch_wrapper/ptf_softmax.py b/modules/pytorch_wrapper/ptf_softmax.py new file mode 100644 index 0000000..c20cd9e --- /dev/null +++ b/modules/pytorch_wrapper/ptf_softmax.py @@ -0,0 +1,41 @@ +from typing import Any, Dict, Callable, Tuple +import torch.nn.functional +import functools + +softmax_last_axis = functools.partial(torch.nn.functional.softmax, dim=-1) + +class PtfSoftmax: + """ + A PyTorch wrapper for the softmax activation function. + + This class provides a callable that applies the softmax activation function + from `torch.nn.functional`. + + Internally, this node calls torch.nn.functional.softmax(dim=-1). + See https://github.com/pytorch/pytorch/issues/1020 to find out more about the meaning of dim. + + category: PyTorch wrapper - Callable + """ + + @classmethod + def INPUT_TYPES(cls) -> Dict[str, Any]: + """ + Defines the required input types. + + Returns: + Dict[str, Any]: An empty dictionary since this function requires no inputs. + """ + return {} + + RETURN_TYPES: Tuple[str, ...] = ("PTCALLABLE",) + FUNCTION: str = "f" + CATEGORY: str = "Data Analysis" + + def f(self) -> Tuple[Callable]: + """ + Returns the PyTorch softmax function as a callable. + + Returns: + Tuple[Callable]: A tuple containing `torch.nn.functional.relu`. + """ + return (softmax_last_axis,) diff --git a/modules/pytorch_wrapper/ptf_softplus.py b/modules/pytorch_wrapper/ptf_softplus.py new file mode 100644 index 0000000..2b16f05 --- /dev/null +++ b/modules/pytorch_wrapper/ptf_softplus.py @@ -0,0 +1,38 @@ +from typing import Any, Dict, Callable, Tuple +import torch.nn.functional + + +class PtfSoftplus: + """ + Ptf Softplus: + + A PyTorch wrapper for the Softplus activation function. + + This class provides a callable that applies the Softplus activation function + from `torch.nn.functional`. + + category: PyTorch wrapper - Callable + """ + + @classmethod + def INPUT_TYPES(cls) -> Dict[str, Any]: + """ + Defines the required input types. + + Returns: + Dict[str, Any]: An empty dictionary since this function requires no inputs. + """ + return {} + + RETURN_TYPES: Tuple[str, ...] = ("PTCALLABLE",) + FUNCTION: str = "f" + CATEGORY: str = "Data Analysis" + + def f(self) -> Tuple[Callable]: + """ + Returns the PyTorch Softplus function as a callable. + + Returns: + Tuple[Callable]: A tuple containing `torch.nn.functional.softplus`. + """ + return (torch.nn.functional.softplus,) diff --git a/modules/pytorch_wrapper/ptf_tanh.py b/modules/pytorch_wrapper/ptf_tanh.py new file mode 100644 index 0000000..b4d6ca5 --- /dev/null +++ b/modules/pytorch_wrapper/ptf_tanh.py @@ -0,0 +1,36 @@ +from typing import Any, Dict, Callable, Tuple +import torch.nn.functional + + +class PtfTanh: + """ + A PyTorch wrapper for the tanh activation function. + + This class provides a callable that applies the tanh activation function + from `torch.nn.functional`. + + category: PyTorch wrapper - Callable + """ + + @classmethod + def INPUT_TYPES(cls) -> Dict[str, Any]: + """ + Defines the required input types. + + Returns: + Dict[str, Any]: An empty dictionary since this function requires no inputs. + """ + return {} + + RETURN_TYPES: Tuple[str, ...] = ("PTCALLABLE",) + FUNCTION: str = "f" + CATEGORY: str = "Data Analysis" + + def f(self) -> Tuple[Callable]: + """ + Returns the PyTorch tanh function as a callable. + + Returns: + Tuple[Callable]: A tuple containing `torch.nn.functional.relu`. + """ + return (torch.nn.functional.tanh,) diff --git a/modules/pytorch_wrapper/ptn_chained_model.py b/modules/pytorch_wrapper/ptn_chained_model.py new file mode 100644 index 0000000..8f7adbf --- /dev/null +++ b/modules/pytorch_wrapper/ptn_chained_model.py @@ -0,0 +1,108 @@ +from typing import Any, Dict, Tuple, Callable, Optional +import torch +import torch.nn as nn + + +class PtnChainedModelDef(nn.Module): + """ + A chained model that sequentially applies `model_a` and `model_b`, + optionally followed by a closure function. + + ### Fields: + - `model_a`: First model in the chain. + - `model_b`: Second model in the chain. + - `closure`: Optional differentiable function to be called at the end of forward. + + Example: + >>> model_a = nn.Linear(10, 20) + >>> model_b = nn.Linear(20, 5) + >>> closure = torch.nn.ReLU() + >>> model = PtnChainedModelDef(model_a, model_b, closure) + >>> x = torch.randn(1, 10) + >>> output = model(x) + + pragma: skip_doc + """ + + def __init__(self, + model_a: nn.Module, + model_b: nn.Module, + closure: Optional[Callable] = None) -> None: + super().__init__() + self.model_a = model_a + self.model_b = model_b + self.closure = closure + + def forward(self, inputs: torch.Tensor) -> torch.Tensor: + """ + Forward pass through the chained models. + + Args: + inputs (torch.Tensor): Input tensor. + + Returns: + torch.Tensor: Output tensor after passing through `model_a`, `model_b`, and optionally `closure`. + """ + x = self.model_a(inputs) + x = self.model_b(x) # Fixed the incorrect use of `inputs` instead of `x` + if self.closure: + x = self.closure(x) + return x + + +class PtnChainedModel: + """ + Constructs a chained PyTorch model. + + ### Fields: + - model_a: First model in the chain. + - model_b: Second model in the chain. + - closure: Optional differentiable function to be called at the end of forward. + + category: PyTorch wrapper - Training + """ + + @classmethod + def INPUT_TYPES(cls) -> Dict[str, Any]: + """ + Defines the expected input types. + + Returns: + Dict[str, Any]: A dictionary specifying required and optional input types. + """ + return { + "required": { + "model_a": ("PTMODEL", {}), + "model_b": ("PTMODEL", {}) + }, + "optional": { + "closure": ("PTCALLABLE", {}) + } + } + + RETURN_TYPES: Tuple[str, ...] = ("PTMODEL",) + FUNCTION: str = "f" + CATEGORY: str = "Training" + + @classmethod + def IS_CHANGED(cls, **kw): + return float("NaN") + + def f(self, + model_a: nn.Module, + model_b: nn.Module, + closure: Optional[Callable] = None) -> Tuple[nn.Module]: + """ + Constructs a chained model with optional closure. + + Args: + model_a (nn.Module): First model in the chain. + model_b (nn.Module): Second model in the chain. + closure (Callable, optional): A function applied after `model_b`. + + Returns: + Tuple[nn.Module]: A tuple containing the instantiated model. + """ + with torch.inference_mode(False): + model = PtnChainedModelDef(model_a, model_b, closure) + return (model,) diff --git a/pyproject.toml b/pyproject.toml index 28c52fc..ef88a29 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "pt-wrapper" description = "PyTorch extension for ComfyUI featuring extensive PyTorch wrapper nodes for seamless tensor operations and PyTorch model training." -version = "3.0.9" +version = "3.0.10" license = {file = "LICENSE"} [project.urls] diff --git a/tests/pytorch_wrapper/pt_apply_function_test.py b/tests/pytorch_wrapper/pt_apply_function_test.py new file mode 100644 index 0000000..e45393a --- /dev/null +++ b/tests/pytorch_wrapper/pt_apply_function_test.py @@ -0,0 +1,42 @@ +import os +import sys +import unittest +import torch + +PROJECT_ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..")) +MODULE_ROOT = os.path.join(PROJECT_ROOT, "modules") +sys.path.append(MODULE_ROOT) + +from pytorch_wrapper.pt_apply_function import PtApplyFunction + + +class TestPtApplyFunction(unittest.TestCase): + def setUp(self): + """Set up test instance.""" + self.node = PtApplyFunction() + + # Softplus function for testing + self.test_function = torch.nn.functional.softplus + + # Test cases: (Input Tensor, Expected Softplus Output) + self.test_cases = [ + (torch.tensor([-1.0, 0.0, 1.0]), self.test_function(torch.tensor([-1.0, 0.0, 1.0]))), + (torch.tensor([[-2.0, 2.0], [3.0, -3.0]]), self.test_function(torch.tensor([[-2.0, 2.0], [3.0, -3.0]]))), + (torch.tensor([0.5, -0.5, 5.0, -5.0]), self.test_function(torch.tensor([0.5, -0.5, 5.0, -5.0]))), + ] + + def test_apply_function(self): + """Test the function application.""" + for input_tensor, expected in self.test_cases: + with self.subTest(input_tensor=input_tensor): + result, = self.node.f(input_tensor, self.test_function) + + # Ensure output is a tensor + self.assertTrue(isinstance(result, torch.Tensor), "Output is not a tensor") + + # Ensure result matches expected output (allowing for floating-point tolerance) + self.assertTrue(torch.allclose(result, expected, atol=1e-6), f"Expected {expected}, got {result}") + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/pytorch_wrapper/ptf_gelu_test.py b/tests/pytorch_wrapper/ptf_gelu_test.py new file mode 100644 index 0000000..4d4ced4 --- /dev/null +++ b/tests/pytorch_wrapper/ptf_gelu_test.py @@ -0,0 +1,45 @@ +import os +import sys +import unittest +import torch +import torch.nn.functional + +PROJECT_ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..")) +MODULE_ROOT = os.path.join(PROJECT_ROOT, "modules") +sys.path.append(MODULE_ROOT) + +from pytorch_wrapper.ptf_gelu import PtfGELU + + +class TestPtfGELU(unittest.TestCase): + def setUp(self): + """Set up test instance.""" + self.node = PtfGELU() + + # Test cases: (Input Tensor, Expected GELU Output) + self.test_cases = [ + (torch.tensor([-1.0, 0.0, 1.0]), torch.nn.functional.gelu(torch.tensor([-1.0, 0.0, 1.0]))), + (torch.tensor([[-1.0, 2.0], [3.0, -4.0]]), torch.nn.functional.gelu(torch.tensor([[-1.0, 2.0], [3.0, -4.0]]))), + (torch.tensor([0.5, -0.5, 2.0, -2.0]), torch.nn.functional.gelu(torch.tensor([0.5, -0.5, 2.0, -2.0]))), + ] + + def test_gelu_function(self): + """Test the returned GELU function.""" + gelu_function, = self.node.f() + + # Ensure return value is callable + self.assertTrue(callable(gelu_function), "Returned value is not callable") + + for input_tensor, expected in self.test_cases: + with self.subTest(input_tensor=input_tensor): + result = gelu_function(input_tensor) + + # Ensure output is a tensor + self.assertTrue(isinstance(result, torch.Tensor), "Output is not a tensor") + + # Ensure result matches expected output + self.assertTrue(torch.equal(result, expected), f"Expected {expected}, got {result}") + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/pytorch_wrapper/ptf_leaky_relu_test.py b/tests/pytorch_wrapper/ptf_leaky_relu_test.py new file mode 100644 index 0000000..81f2dd4 --- /dev/null +++ b/tests/pytorch_wrapper/ptf_leaky_relu_test.py @@ -0,0 +1,44 @@ +import os +import sys +import unittest +import torch + +PROJECT_ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..")) +MODULE_ROOT = os.path.join(PROJECT_ROOT, "modules") +sys.path.append(MODULE_ROOT) + +from pytorch_wrapper.ptf_leaky_relu import PtfLeakyReLU + + +class TestPtfRelu(unittest.TestCase): + def setUp(self): + """Set up test instance.""" + self.node = PtfLeakyReLU() + + # Test cases: (Input Tensor, Expected LeakyReLU Output) + self.test_cases = [ + (torch.tensor([-1.0, 0.0, 1.0]), torch.tensor([-0.1, 0.0, 1.0])), + (torch.tensor([[-1.0, 2.0], [3.0, -4.0]]), torch.tensor([[-0.1, 2.0], [3.0, -0.4]])), + (torch.tensor([0.5, -0.5, 2.0, -2.0]), torch.tensor([0.5, -0.05, 2.0, -0.2])), + ] + + def test_leaky_relu_function(self): + """Test the returned LeakyReLU function.""" + leaky_relu_function, = self.node.f(negative_slope=0.1) + + # Ensure return value is callable + self.assertTrue(callable(leaky_relu_function), "Returned value is not callable") + + for input_tensor, expected in self.test_cases: + with self.subTest(input_tensor=input_tensor): + result = leaky_relu_function(input_tensor) + + # Ensure output is a tensor + self.assertTrue(isinstance(result, torch.Tensor), "Output is not a tensor") + + # Ensure result matches expected output + self.assertTrue(torch.equal(result, expected), f"Expected {expected}, got {result}") + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/pytorch_wrapper/ptf_log_softmax_test.py b/tests/pytorch_wrapper/ptf_log_softmax_test.py new file mode 100644 index 0000000..a959b10 --- /dev/null +++ b/tests/pytorch_wrapper/ptf_log_softmax_test.py @@ -0,0 +1,54 @@ +import os +import sys +import unittest +import torch +import torch.nn.functional + +PROJECT_ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..")) +MODULE_ROOT = os.path.join(PROJECT_ROOT, "modules") +sys.path.append(MODULE_ROOT) + +from pytorch_wrapper.ptf_log_softmax import PtfLogSoftmax + + +def compute_log_softmax(x, dim=-1): + return torch.nn.functional.log_softmax(x, dim=dim) + + +class TestPtfLogSoftmax(unittest.TestCase): + def setUp(self): + """Set up test instance.""" + self.node = PtfLogSoftmax() + + # Test cases: (Input Tensor, Expected LogSoftmax Output) + self.test_cases = [ + # Rank-1 tensor + (torch.tensor([0.0, -100.0, 100.0]), compute_log_softmax(torch.tensor([0.0, -100.0, 100.0]))), + # # Rank-2 tensor dim=-1 + (torch.tensor([[-1.0, 2.0, 3.0], [0.0, 1.0, -1.0]]), compute_log_softmax(torch.tensor([[-1.0, 2.0, 3.0], [0.0, 1.0, -1.0]]))), + # # Rank-2 tensor dim=1 + (torch.tensor([[-1.0, 2.0, 3.0], [0.0, 1.0, -1.0]]), compute_log_softmax(torch.tensor([[-1.0, 2.0, 3.0], [0.0, 1.0, -1.0]]), dim=1)), + # # Rank-3 tensor + (torch.tensor([[[1.0, 2.0], [3.0, 4.0]], [[0.0, -1.0], [-2.0, -3.0]]]), compute_log_softmax(torch.tensor([[[1.0, 2.0], [3.0, 4.0]], [[0.0, -1.0], [-2.0, -3.0]]]))), + ] + + def test_log_softmax_function(self): + """Test the returned LogSoftmax function.""" + log_softmax_function, = self.node.f() + + # Ensure return value is callable + self.assertTrue(callable(log_softmax_function), "Returned value is not callable") + + for input_tensor, expected in self.test_cases: + with self.subTest(input_tensor=input_tensor): + result = log_softmax_function(input_tensor) + + # Ensure output is a tensor + self.assertTrue(isinstance(result, torch.Tensor), "Output is not a tensor") + + # Ensure result matches expected output + self.assertTrue(torch.allclose(result, expected, atol=1e-6), f"Expected {expected}, got {result}") + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/pytorch_wrapper/ptf_relu_test.py b/tests/pytorch_wrapper/ptf_relu_test.py new file mode 100644 index 0000000..e4ca4aa --- /dev/null +++ b/tests/pytorch_wrapper/ptf_relu_test.py @@ -0,0 +1,44 @@ +import os +import sys +import unittest +import torch + +PROJECT_ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..")) +MODULE_ROOT = os.path.join(PROJECT_ROOT, "modules") +sys.path.append(MODULE_ROOT) + +from pytorch_wrapper.ptf_relu import PtfReLU + + +class TestPtfRelu(unittest.TestCase): + def setUp(self): + """Set up test instance.""" + self.node = PtfReLU() + + # Test cases: (Input Tensor, Expected ReLU Output) + self.test_cases = [ + (torch.tensor([-1, 0, 1]), torch.tensor([0, 0, 1])), + (torch.tensor([[-1, 2], [3, -4]]), torch.tensor([[0, 2], [3, 0]])), + (torch.tensor([0.5, -0.5, 2.0, -2.0]), torch.tensor([0.5, 0, 2.0, 0])), + ] + + def test_relu_function(self): + """Test the returned ReLU function.""" + relu_function, = self.node.f() + + # Ensure return value is callable + self.assertTrue(callable(relu_function), "Returned value is not callable") + + for input_tensor, expected in self.test_cases: + with self.subTest(input_tensor=input_tensor): + result = relu_function(input_tensor) + + # Ensure output is a tensor + self.assertTrue(isinstance(result, torch.Tensor), "Output is not a tensor") + + # Ensure result matches expected output + self.assertTrue(torch.equal(result, expected), f"Expected {expected}, got {result}") + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/pytorch_wrapper/ptf_sigmoid_test.py b/tests/pytorch_wrapper/ptf_sigmoid_test.py new file mode 100644 index 0000000..9c05dcb --- /dev/null +++ b/tests/pytorch_wrapper/ptf_sigmoid_test.py @@ -0,0 +1,44 @@ +import os +import sys +import unittest +import torch + +PROJECT_ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..")) +MODULE_ROOT = os.path.join(PROJECT_ROOT, "modules") +sys.path.append(MODULE_ROOT) + +from pytorch_wrapper.ptf_sigmoid import PtfSigmoid + + +class TestPtfSigmoid(unittest.TestCase): + def setUp(self): + """Set up test instance.""" + self.node = PtfSigmoid() + + # Test cases: (Input Tensor, Expected Sigmoid Output) + self.test_cases = [ + (torch.tensor([0, -100.0, 100.0]), torch.tensor([0.5, 0.0, 1.0])), + (torch.tensor([[-1000000.0, 200.0], [3000.0, -400.0]]), torch.tensor([[0.0, 1.0], [1, 0]])), + (torch.tensor([0.0, -100.0, 200.0, -20.0]), torch.tensor([0.5, 0.0, 1.0, 0.0])), + ] + + def test_sigmoid_function(self): + """Test the returned Sigmoid function.""" + sigmoid_function, = self.node.f() + + # Ensure return value is callable + self.assertTrue(callable(sigmoid_function), "Returned value is not callable") + + for input_tensor, expected in self.test_cases: + with self.subTest(input_tensor=input_tensor): + result = sigmoid_function(input_tensor) + + # Ensure output is a tensor + self.assertTrue(isinstance(result, torch.Tensor), "Output is not a tensor") + + # Ensure result matches expected output + self.assertTrue(torch.allclose(result, expected, atol=1e6), f"Expected {expected}, got {result}") + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/pytorch_wrapper/ptf_silu_test.py b/tests/pytorch_wrapper/ptf_silu_test.py new file mode 100644 index 0000000..8c1eb9a --- /dev/null +++ b/tests/pytorch_wrapper/ptf_silu_test.py @@ -0,0 +1,45 @@ +import os +import sys +import unittest +import torch +import torch.nn.functional + +PROJECT_ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..")) +MODULE_ROOT = os.path.join(PROJECT_ROOT, "modules") +sys.path.append(MODULE_ROOT) + +from pytorch_wrapper.ptf_silu import PtfSiLU + + +class TestPtfSiLU(unittest.TestCase): + def setUp(self): + """Set up test instance.""" + self.node = PtfSiLU() + + # Test cases: (Input Tensor, Expected SiLU Output) + self.test_cases = [ + (torch.tensor([-1.0, 0.0, 1.0]), torch.nn.functional.silu(torch.tensor([-1.0, 0.0, 1.0]))), + (torch.tensor([[-1.0, 2.0], [3.0, -4.0]]), torch.nn.functional.silu(torch.tensor([[-1.0, 2.0], [3.0, -4.0]]))), + (torch.tensor([0.5, -0.5, 2.0, -2.0]), torch.nn.functional.silu(torch.tensor([0.5, -0.5, 2.0, -2.0]))), + ] + + def test_silu_function(self): + """Test the returned SiLU function.""" + silu_function, = self.node.f() + + # Ensure return value is callable + self.assertTrue(callable(silu_function), "Returned value is not callable") + + for input_tensor, expected in self.test_cases: + with self.subTest(input_tensor=input_tensor): + result = silu_function(input_tensor) + + # Ensure output is a tensor + self.assertTrue(isinstance(result, torch.Tensor), "Output is not a tensor") + + # Ensure result matches expected output + self.assertTrue(torch.equal(result, expected), f"Expected {expected}, got {result}") + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/pytorch_wrapper/ptf_softmax_test.py b/tests/pytorch_wrapper/ptf_softmax_test.py new file mode 100644 index 0000000..2b30656 --- /dev/null +++ b/tests/pytorch_wrapper/ptf_softmax_test.py @@ -0,0 +1,55 @@ +import os +import sys +import unittest +import torch +import torch.nn.functional + +PROJECT_ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..")) +MODULE_ROOT = os.path.join(PROJECT_ROOT, "modules") +sys.path.append(MODULE_ROOT) + +from pytorch_wrapper.ptf_softmax import PtfSoftmax + + +def compute_softmax(x, dim=-1): + return torch.nn.functional.softmax(x, dim=dim) + + +class TestPtfSoftmax(unittest.TestCase): + def setUp(self): + """Set up test instance.""" + self.node = PtfSoftmax() + + # Test cases: (Input Tensor, Expected Softmax Output) + self.test_cases = [ + # Rank-1 tensor + (torch.tensor([0.0, -100.0, 100.0]), compute_softmax(torch.tensor([0.0, -100.0, 100.0]))), + # # Rank-2 tensor + (torch.tensor([[-1.0, 2.0, 3.0], [0.0, 1.0, -1.0]]), compute_softmax(torch.tensor([[-1.0, 2.0, 3.0], [0.0, 1.0, -1.0]]))), + # # Rank-2 tensor. Check dim=-1 maps to 1. + (torch.tensor([[-1.0, 2.0, 3.0], [0.0, 1.0, -1.0]]), compute_softmax(torch.tensor([[-1.0, 2.0, 3.0], [0.0, 1.0, -1.0]]), dim=1)), + + # # Rank-3 tensor + (torch.tensor([[[1.0, 2.0], [3.0, 4.0]], [[0.0, -1.0], [-2.0, -3.0]]]), compute_softmax(torch.tensor([[[1.0, 2.0], [3.0, 4.0]], [[0.0, -1.0], [-2.0, -3.0]]]))), + ] + + def test_softmax_function(self): + """Test the returned Softmax function.""" + softmax_function, = self.node.f() + + # Ensure return value is callable + self.assertTrue(callable(softmax_function), "Returned value is not callable") + + for input_tensor, expected in self.test_cases: + with self.subTest(input_tensor=input_tensor): + result = softmax_function(input_tensor) + + # Ensure output is a tensor + self.assertTrue(isinstance(result, torch.Tensor), "Output is not a tensor") + + # Ensure result matches expected output + self.assertTrue(torch.allclose(result, expected, atol=1e-6), f"Expected {expected}, got {result}") + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/pytorch_wrapper/ptf_softplus_test.py b/tests/pytorch_wrapper/ptf_softplus_test.py new file mode 100644 index 0000000..c62e754 --- /dev/null +++ b/tests/pytorch_wrapper/ptf_softplus_test.py @@ -0,0 +1,44 @@ +import os +import sys +import unittest +import torch + +PROJECT_ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..")) +MODULE_ROOT = os.path.join(PROJECT_ROOT, "modules") +sys.path.append(MODULE_ROOT) + +from pytorch_wrapper.ptf_softplus import PtfSoftplus + + +class TestPtfSoftplus(unittest.TestCase): + def setUp(self): + """Set up test instance.""" + self.node = PtfSoftplus() + + # Test cases: (Input Tensor, Expected Softplus Output) + self.test_cases = [ + (torch.tensor([-1.0, 0.0, 1.0]), torch.nn.functional.softplus(torch.tensor([-1.0, 0.0, 1.0]))), + (torch.tensor([[-2.0, 2.0], [3.0, -3.0]]), torch.nn.functional.softplus(torch.tensor([[-2.0, 2.0], [3.0, -3.0]]))), + (torch.tensor([0.5, -0.5, 5.0, -5.0]), torch.nn.functional.softplus(torch.tensor([0.5, -0.5, 5.0, -5.0]))), + ] + + def test_softplus_function(self): + """Test the returned Softplus function.""" + softplus_function, = self.node.f() + + # Ensure return value is callable + self.assertTrue(callable(softplus_function), "Returned value is not callable") + + for input_tensor, expected in self.test_cases: + with self.subTest(input_tensor=input_tensor): + result = softplus_function(input_tensor) + + # Ensure output is a tensor + self.assertTrue(isinstance(result, torch.Tensor), "Output is not a tensor") + + # Ensure result matches expected output (allowing for floating-point tolerance) + self.assertTrue(torch.allclose(result, expected, atol=1e-6), f"Expected {expected}, got {result}") + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/pytorch_wrapper/ptf_tanh_test.py b/tests/pytorch_wrapper/ptf_tanh_test.py new file mode 100644 index 0000000..c473945 --- /dev/null +++ b/tests/pytorch_wrapper/ptf_tanh_test.py @@ -0,0 +1,44 @@ +import os +import sys +import unittest +import torch + +PROJECT_ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..")) +MODULE_ROOT = os.path.join(PROJECT_ROOT, "modules") +sys.path.append(MODULE_ROOT) + +from pytorch_wrapper.ptf_tanh import PtfTanh + + +class TestPtfTanh(unittest.TestCase): + def setUp(self): + """Set up test instance.""" + self.node = PtfTanh() + + # Test cases: (Input Tensor, Expected Tanh Output) + self.test_cases = [ + (torch.tensor([0, -100.0, 100.0]), torch.tensor([0.0, -1.0, 1.0])), + (torch.tensor([[-1000000.0, 200.0], [3000.0, -400.0]]), torch.tensor([[-1.0, 1.0], [1.0, -1.0]])), + (torch.tensor([0.0, -100.0, 200.0, -20.0]), torch.tensor([0.0, -1.0, 1.0, -1.0])), + ] + + def test_tanh_function(self): + """Test the returned Tanh function.""" + tanh_function, = self.node.f() + + # Ensure return value is callable + self.assertTrue(callable(tanh_function), "Returned value is not callable") + + for input_tensor, expected in self.test_cases: + with self.subTest(input_tensor=input_tensor): + result = tanh_function(input_tensor) + + # Ensure output is a tensor + self.assertTrue(isinstance(result, torch.Tensor), "Output is not a tensor") + + # Ensure result matches expected output + self.assertTrue(torch.allclose(result, expected, atol=1e6), f"Expected {expected}, got {result}") + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/pytorch_wrapper/ptn_chained_model_test.py b/tests/pytorch_wrapper/ptn_chained_model_test.py new file mode 100644 index 0000000..6220b01 --- /dev/null +++ b/tests/pytorch_wrapper/ptn_chained_model_test.py @@ -0,0 +1,68 @@ +import os +import sys +import unittest +import torch +import torch.nn as nn + +PROJECT_ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..")) +MODULE_ROOT = os.path.join(PROJECT_ROOT, "modules") +sys.path.append(MODULE_ROOT) + +from pytorch_wrapper.ptn_chained_model import PtnChainedModel + + +class TestPtnChainedModel(unittest.TestCase): + def setUp(self) -> None: + """Set up test instance with dummy models.""" + self.node = PtnChainedModel() + + class ModelA(nn.Module): + def __init__(self): + super().__init__() + self.layer = nn.Linear(3, 3, bias=False) + self.layer.weight = nn.Parameter(torch.eye(3), requires_grad=True) # Identity + + def forward(self, x: torch.Tensor) -> torch.Tensor: + return self.layer(x) + + class ModelB(nn.Module): + def __init__(self): + super().__init__() + self.layer = nn.Linear(3, 3, bias=False) + self.layer.weight = nn.Parameter(torch.eye(3)*0.2, requires_grad=True) # Multiply by 0.2 + + def forward(self, x: torch.Tensor) -> torch.Tensor: + return self.layer(x) + + self.model_a = ModelA() + self.model_b = ModelB() + self.closure = nn.ReLU() # Apply ReLU as the closure + + def test_forward_pass(self) -> None: + """Test forward pass through the chained model.""" + model, = self.node.f(self.model_a, self.model_b, self.closure) + + # Input tensor + input_tensor = torch.tensor([[1.0, 0.0, -1.0]], dtype=torch.float32) + + # Expected transformation: + # ModelA (Identity): [1, 0, -1] + # ModelB (*0.5): [0.2, 0, -0.2] + # Closure (ReLU): [0.2, 0, 0] + expected_output = torch.tensor([[0.2, 0.0, 0.0]], dtype=torch.float32) + + # Get output from the chained model + output = model(input_tensor) + + # Ensure output is a tensor + self.assertIsInstance(output, torch.Tensor, "Output is not a tensor") + + # Ensure output shape matches expected + self.assertEqual(output.shape, expected_output.shape, "Output shape mismatch") + + # Ensure output values match expected + self.assertTrue(torch.allclose(output, expected_output, atol=1e-6), + f"Expected {expected_output}, got {output}") + +if __name__ == "__main__": + unittest.main()