Files
HowToSD-ComfyUI-Pt-Wrapper/docs/reference/node_reference.md
T

13 KiB

Node Reference

Display data

Node Description
Pt Show Size Displays PyTorch Size object as a string.
Pt Show Text Displays PyTorch tensor as a string. Note that the tensor is partially printed out when

IO

Node Description
Pt Save Model A wrapper class for saving a PyTorch model.

PyTorch wrapper - Arithmetic operations

Node Description
Pt Add Adds two PyTorch tensors.
Pt Div Divides one PyTorch tensor by another element-wise.
Pt Floor Div Performs element-wise floor division on two PyTorch tensors.
Pt Mul Multiplies two PyTorch tensors element-wise.
Pt Pow Raises one PyTorch tensor to the power of another element-wise.
Pt Remainder Computes the element-wise remainder of division between two PyTorch tensors.
Pt Sub Subtracts one PyTorch tensor from another.

PyTorch wrapper - Bitwise operations

Node Description
Pt Bitwise And Performs a bitwise AND operation on two PyTorch tensors element-wise.
Pt Bitwise Left Shift Performs a bitwise left shift operation on two PyTorch tensors element-wise.
Pt Bitwise Not Performs a bitwise NOT operation on a PyTorch tensor element-wise.
Pt Bitwise Or Performs a bitwise OR operation on two PyTorch tensors element-wise.
Pt Bitwise Right Shift Performs a bitwise right shift operation on two PyTorch tensors element-wise.
Pt Bitwise Xor Performs a bitwise XOR operation on two PyTorch tensors element-wise.

PyTorch wrapper - Comparison operations

Node Description
Pt Eq Tests whether two PyTorch tensors are equal element-wise.
Pt Ge Tests whether elements in the first PyTorch tensor are greater than or equal to the corresponding elements in the second tensor.
Pt Gt Tests whether elements in the first PyTorch tensor are greater than the corresponding elements in the second tensor.
Pt Le Tests whether elements in the first PyTorch tensor are less than or equal to the corresponding elements in the second tensor.
Pt Lt Tests whether elements in the first PyTorch tensor are less than the corresponding elements in the second tensor.
Pt Ne Tests whether two PyTorch tensors are not equal element-wise.

PyTorch wrapper - Image processing

Node Description
Pt Crop Crops a PyTorch tensor to the specified size. The input tensor must have a shape of (c, h, w) or (b, c, h, w).
Pt From Image Casts an Image tensor as a PyTorch tensor.
Pt From Image Transpose Casts an image tensor to a PyTorch tensor and transposes it from (H, W, C) to (C, H, W). For rank-4 inputs, the batch axis remains unchanged.
Pt Interpolate By Scale Factor Resizes a PyTorch tensor using interpolation by scale factor. The input tensor must have a shape of (c, h, w) or (b, c, h, w).
Pt Interpolate To Size Resizes a PyTorch tensor using interpolation. The input tensor must have a shape of (c, h, w) or (b, c, h, w).
Pt Pad Pads a PyTorch tensor to the specified size. Padded area will be black. The input tensor must have a shape of (c, h, w) or (b, c, h, w).
Pt To Image Casts a PyTorch tensor as an Image tensor.
Pt To Image Transpose Casts a PyTorch tensor as an Image tensor and transposes it from (C, H, W) to (H, W, C). For rank-4 inputs, the batch axis remains unchanged.

PyTorch wrapper - Indexing and Slicing Operations

Node Description
Pt Gather Generates a tensor based on the index tensor using PyTorch's gather function.
Pt Index Select Extracts elements from the input tensor along a specified dimension using an index tensor.
Pt Masked Select Extracts elements from the input tensor whose corresponding value in masked_tens is True.
Pt Scatter Generates a new tensor by replacing values at specified positions using an index tensor.
Pt Where Generates a new tensor by selecting values based on a condition tensor.

PyTorch wrapper - Logical operations

Node Description
Pt Logical And Performs a logical AND operation on two PyTorch tensors element-wise.
Pt Logical Not Performs a logical NOT operation on a PyTorch tensor element-wise.
Pt Logical Or Performs a logical OR operation on two PyTorch tensors element-wise.
Pt Logical Xor Performs a logical XOR operation on two PyTorch tensors element-wise.

PyTorch wrapper - Math operations

Node Description
Pt Abs Computes the absolute value of each element in a PyTorch tensor.
Pt Acos Computes the arccosine (inverse cosine) of a PyTorch tensor element-wise.
Pt Asin Computes the arcsine (inverse sine) of a PyTorch tensor element-wise.
Pt Atan Computes the arc tangent (inverse tangent) of a PyTorch tensor element-wise.
Pt Cos Computes the cosine of a PyTorch tensor element-wise.
Pt Cosh Computes the hyperbolic cosine of a PyTorch tensor element-wise.
Pt Exp Performs an exponential operation on a PyTorch tensor element-wise.
Pt Log Computes the natural logarithm (log base e) of a PyTorch tensor element-wise.
Pt Neg Computes the negation of each element in a PyTorch tensor.
Pt Sin Computes the sine of a PyTorch tensor element-wise.
Pt Sinh Computes the hyperbolic sine of a PyTorch tensor element-wise.
Pt Sqrt Computes the square root of each element in a PyTorch tensor.
Pt Tan Computes the tangent of a PyTorch tensor element-wise.
Pt Tanh Computes the hyperbolic tangent of a PyTorch tensor element-wise.

PyTorch wrapper - Matrix operations

Node Description
Pt Bmm Performs batched matrix multiplication on two 3D PyTorch tensors.
Pt Einsum Performs Tensor operations specified in the Einstein summation equation.
Pt Mat Mul Performs matrix multiplication on two PyTorch tensors.
Pt Mm Performs 2D matrix multiplication on two PyTorch tensors.

PyTorch wrapper - Reduction operation & Summary statistics

Node Description
Pt Argmax Computes the indices of the maximum values of a PyTorch tensor along the specified dimension(s).
Pt Argmin Computes the indices of the minimum values of a PyTorch tensor along the specified dimension(s).
Pt Max Computes the maximum values of a PyTorch tensor along the specified dimension(s).
Pt Mean Computes the mean of a PyTorch tensor along the specified dimension(s).
Pt Median Computes the median of a PyTorch tensor along the specified dimension(s).
Pt Min Computes the minimum values of a PyTorch tensor along the specified dimension(s).
Pt Prod Computes the product of a PyTorch tensor along the specified dimension(s).
Pt Std Computes the standard deviation of a PyTorch tensor along the specified dimension(s).
Pt Sum Computes the sum of a PyTorch tensor along the specified dimension(s).
Pt Var Computes the variance of a PyTorch tensor along the specified dimension(s).

PyTorch wrapper - Size object support

Node Description
Pt Size Extracts the PyTorch Size object of a PyTorch tensor using the size() method.
Pt Size Create Creates a PyTorch Size using values entered in the text field.
Pt Size To Numpy Converts PyTorch Size object to NumPy ndarray.
Pt Size To String Converts PyTorch Size object to a Python string.

PyTorch wrapper - Tensor creation

Node Description
Pt Arange Creates a PyTorch tensor using torch.arange with the specified start, end, and step values.
Pt Bool Create Creates a PyTorch tensor of dtype bool from True or False values entered as a list in the text field.
Pt Float Create Creates a PyTorch tensor with 32-bit floating point precision
Pt From Latent Casts a latent tensor as a PyTorch tensor.
Pt From Numpy Converts a NumPy ndarray to a PyTorch tensor while preserving its data type.
Pt Full Creates a PyTorch tensor filled with a specified value using the size entered in the text field.
Pt Int Create Creates a PyTorch tensor with 32-bit integer
Pt Linspace Creates a PyTorch tensor using torch.linspace with the specified start, end, and steps values.
Pt Ones Creates a PyTorch tensor of ones using the size entered in the text field.
Pt Rand Creates a PyTorch tensor with values sampled from a uniform distribution
Pt Rand Int Creates a PyTorch tensor filled with random integers within a specified range using the size entered in the text field.
Pt Randn Creates a PyTorch tensor with values sampled from a standard normal distribution (mean=0, std=1)
Pt Zeros Creates a PyTorch tensor of zeros using the size entered in the text field.

PyTorch wrapper - Tensor data conversion

Node Description
Pt To Latent Casts a PyTorch tensor as a latent tensor.
Pt To Numpy Converts PyTorch tensor to NumPy ndarray.
Pt To Rgb Tensors Splits a PyTorch tensor into R, G, and B tensors.

PyTorch wrapper - Training

Node Description
Pt Data Loader Loads data from a dataset node and creates a PyTorch DataLoader.
Pt Evaluate Classification Model Performs inference on test data and computes evaluation metrics.
Pt Load Model A wrapper class for saving a PyTorch model.
Pt Predict Classification Model Performs inference on input data.
Pt Train Classification Model Trains a classification model using a given dataset, optimizer, and number of epochs.
Ptn Conv Model A convolutional model consisting of multiple convolutional layers.
Ptn Linear Model A linear model consisting of dense layers.
Ptn Resnet Model A Resnet model consisting of multiple Resnet layers.
Pto Adam Instantiates the Adam optimizer.
Ptv Dataset A Torchvision Dataset class wrapper.
Ptv Dataset Len A wrapper class that calls Python len on a dataset.
Ptv Dataset Loader A node to combine the dataset and data loader into a single node.
Ptv Image Folder Dataset A Torchvision ImageFolder Dataset class wrapper.
Ptv Transforms Data Augment Applies data augmentation transformations to dataset elements.
Ptv Transforms Resize Resizes and transforms elements of dataset to PyTorch tensors.
Ptv Transforms To Tensor Transforms elements of dataset to PyTorch tensors.

PyTorch wrapper - Transform

Node Description
Pt Flatten Flattens a PyTorch tensor into a 1D tensor.
Pt Permute Permutes the dimensions of a PyTorch tensor according to the specified order.
Pt Reshape Reshapes a PyTorch tensor into a specified shape using torch.reshape().
Pt Squeeze Removes a dimension at the specified position in the input tensor if it is of size 1.
Pt Unsqueeze Adds a singleton dimension at the specified position in the input tensor.
Pt View Reshapes a PyTorch tensor into a specified shape using torch.view().