Upload folder using huggingface_hub
Browse files- main/hd_painter.py +17 -10
main/hd_painter.py
CHANGED
|
@@ -898,13 +898,16 @@ class GaussianSmoothing(nn.Module):
|
|
| 898 |
Apply gaussian smoothing on a
|
| 899 |
1d, 2d or 3d tensor. Filtering is performed seperately for each channel
|
| 900 |
in the input using a depthwise convolution.
|
| 901 |
-
|
| 902 |
-
|
| 903 |
-
|
| 904 |
-
|
| 905 |
-
|
| 906 |
-
|
| 907 |
-
|
|
|
|
|
|
|
|
|
|
| 908 |
"""
|
| 909 |
|
| 910 |
def __init__(self, channels, kernel_size, sigma, dim=2):
|
|
@@ -944,10 +947,14 @@ class GaussianSmoothing(nn.Module):
|
|
| 944 |
def forward(self, input):
|
| 945 |
"""
|
| 946 |
Apply gaussian filter to input.
|
| 947 |
-
|
| 948 |
-
|
|
|
|
|
|
|
|
|
|
| 949 |
Returns:
|
| 950 |
-
|
|
|
|
| 951 |
"""
|
| 952 |
return self.conv(input, weight=self.weight.to(input.dtype), groups=self.groups, padding="same")
|
| 953 |
|
|
|
|
| 898 |
Apply gaussian smoothing on a
|
| 899 |
1d, 2d or 3d tensor. Filtering is performed seperately for each channel
|
| 900 |
in the input using a depthwise convolution.
|
| 901 |
+
|
| 902 |
+
Args:
|
| 903 |
+
channels (`int` or `sequence`):
|
| 904 |
+
Number of channels of the input tensors. The output will have this number of channels as well.
|
| 905 |
+
kernel_size (`int` or `sequence`):
|
| 906 |
+
Size of the Gaussian kernel.
|
| 907 |
+
sigma (`float` or `sequence`):
|
| 908 |
+
Standard deviation of the Gaussian kernel.
|
| 909 |
+
dim (`int`, *optional*, defaults to `2`):
|
| 910 |
+
The number of dimensions of the data. Default is 2 (spatial dimensions).
|
| 911 |
"""
|
| 912 |
|
| 913 |
def __init__(self, channels, kernel_size, sigma, dim=2):
|
|
|
|
| 947 |
def forward(self, input):
|
| 948 |
"""
|
| 949 |
Apply gaussian filter to input.
|
| 950 |
+
|
| 951 |
+
Args:
|
| 952 |
+
input (`torch.Tensor` of shape `(N, C, H, W)`):
|
| 953 |
+
Input to apply Gaussian filter on.
|
| 954 |
+
|
| 955 |
Returns:
|
| 956 |
+
`torch.Tensor`:
|
| 957 |
+
The filtered output tensor with the same shape as the input.
|
| 958 |
"""
|
| 959 |
return self.conv(input, weight=self.weight.to(input.dtype), groups=self.groups, padding="same")
|
| 960 |
|