Added BatchNorm2d, LayerNorm, InstanceNorm2d nodes.

This commit is contained in:
HowToSD
2025-03-19 22:15:19 -07:00
parent ae8a6cfb90
commit 05196abbad
19 changed files with 558 additions and 11 deletions
+6 -3
View File
@@ -138,13 +138,16 @@
## PyTorch wrapper - Model
| Node | Description |
| --- | --- |
| [Ptn Avg Pool](ptn_avg_pool2d.md) | An avgpool layer. |
| [Ptn Avg Pool 2d](ptn_avg_pool2d.md) | An avgpool layer. |
| [Ptn Batch Norm 2d](ptn_batch_norm2d.md) | A normalization model to normalize over the batch and spatial axes for each channel. |
| [Ptn Chained Model](ptn_chained_model.md) | Constructs a chained PyTorch model. |
| [Ptn Conv](ptn_conv2d.md) | A convolutional model consisting of a single conv2d layer. |
| [Ptn Conv 2d](ptn_conv2d.md) | A convolutional model consisting of a single conv2d layer. |
| [Ptn Conv Model](ptn_conv_model.md) | A convolutional model consisting of multiple convolutional layers. |
| [Ptn Instance Norm 2d](ptn_instance_norm2d.md) | A normalization model to normalize elements over spatial axes within each channel for each sample. |
| [Ptn Layer Norm](ptn_layer_norm.md) | A normalization model to normalize elements over specified axes. |
| [Ptn Linear](ptn_linear.md) | A linear model consisting of a single dense layer. |
| [Ptn Linear Model](ptn_linear_model.md) | A linear model consisting of dense layers. |
| [Ptn Max Pool](ptn_max_pool2d.md) | A maxpool layer. |
| [Ptn Max Pool 2d](ptn_max_pool2d.md) | A maxpool layer. |
| [Ptn Pre Add Channel Axis](ptn_pre_add_channel_axis.md) | Adds a channel axis after the batch axis if the input is rank 3 (bs, h, w) |
| [Ptn Pre Flatten](ptn_pre_flatten.md) | Flattens the input tensor before processing the tensor in the specified model. |
| [Ptn Resnet Model](ptn_resnet_model.md) | A Resnet model consisting of multiple Resnet layers. |
+1 -1
View File
@@ -1,4 +1,4 @@
# Ptn Avg Pool
# Ptn Avg Pool 2d
An avgpool layer.
Args:
+30
View File
@@ -0,0 +1,30 @@
# Ptn Batch Norm 2d
A normalization model to normalize over the batch and spatial axes for each channel.
Args:
num_features (int): Specifies the size of channel axis.
- For an image input of shape `[8, 4, 256, 256]`, specify 4.
affine (bool): If `True`, applies a learnable scaling factor and bias to the normalized elements.
track_running_stats (bool): If `True`, use exponential moving average (EMA) to store mean and std to be used in eval for normalization. For training, current batch statistics are always used for mean and std irrespective of this flag.
momentum (float): The EMA coefficient used if track_running_stats is set to True. Higher values give more weight to the current batch statistics, while lower values retain more past statistics.
## Input
| Name | Data type |
|---|---|
| num_features | Int |
| affine | Boolean |
| track_running_stats | Boolean |
| momentum | Float |
## Output
| Data type |
|---|
| Ptmodel |
<HR>
Category: PyTorch wrapper - Model
ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
+1 -1
View File
@@ -1,4 +1,4 @@
# Ptn Conv
# Ptn Conv 2d
A convolutional model consisting of a single conv2d layer.
Args:
+30
View File
@@ -0,0 +1,30 @@
# Ptn Instance Norm 2d
A normalization model to normalize elements over spatial axes within each channel for each sample.
Args:
num_features (int): Specifies the size of channel axis.
- For an image input of shape `[8, 4, 256, 256]`, specify 4.
affine (bool): If `True`, applies a learnable scaling factor and bias to the normalized elements.
track_running_stats (bool): If `True`, use exponential moving average (EMA) to store mean and std to be used in eval for normalization. For training, current sample data is always used for mean and std irrespective of this flag.
momentum (float): The EMA coefficient used if track_running_stats is set to True. Higher value gives more weight to the current statistics (mean & std).
## Input
| Name | Data type |
|---|---|
| num_features | Int |
| affine | Boolean |
| track_running_stats | Boolean |
| momentum | Float |
## Output
| Data type |
|---|
| Ptmodel |
<HR>
Category: PyTorch wrapper - Model
ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
+32
View File
@@ -0,0 +1,32 @@
# Ptn Layer Norm
A normalization model to normalize elements over specified axes.
Args:
normalized_shape (list): Specifies the shape of elements to normalize.
- For an input of shape `[8, 1024, 768]` (where axes represent `[batch_size, sequence_length, hidden_dim]`):
- `normalize_shape=[768]` normalizes within each token (across the hidden dimension).
- `normalize_shape=[1024, 768]` normalizes within each sample (across both sequence and token dimensions).
- For an image input of shape `[8, 4, 256, 256]` (where axes represent `[batch_size, channel, height, width]`):
- `normalize_shape=[256, 256]` normalizes within each channel (across spatial dimensions).
- `normalize_shape=[4, 256, 256]` normalizes within each sample (across channels and spatial dimensions).
elementwise_affine (bool): If `True`, applies a learnable scaling factor to the normalized elements.
bias (bool): If `True` and elementwise_affine is also `True`, applies a learnable bias to the normalized elements.
## Input
| Name | Data type |
|---|---|
| normalized_shape | String |
| elementwise_affine | Boolean |
| bias | Boolean |
## Output
| Data type |
|---|
| Ptmodel |
<HR>
Category: PyTorch wrapper - Model
ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
+1 -1
View File
@@ -1,4 +1,4 @@
# Ptn Max Pool
# Ptn Max Pool 2d
A maxpool layer.
Args: