Unverified Commit fff4be8e authored by wony617's avatar wony617 Committed by GitHub
Browse files

[docs] refactoring docstrings in `community/hd_painter.py` (#9593)



* [docs] refactoring docstrings in community/hd_painter.py

* Update examples/community/hd_painter.py
Co-authored-by: default avatarAryan <contact.aryanvs@gmail.com>

* make style

---------
Co-authored-by: default avatarAryan <contact.aryanvs@gmail.com>
Co-authored-by: default avatarAryan <aryan@huggingface.co>
parent 355bb641
...@@ -898,13 +898,16 @@ class GaussianSmoothing(nn.Module): ...@@ -898,13 +898,16 @@ class GaussianSmoothing(nn.Module):
Apply gaussian smoothing on a Apply gaussian smoothing on a
1d, 2d or 3d tensor. Filtering is performed seperately for each channel 1d, 2d or 3d tensor. Filtering is performed seperately for each channel
in the input using a depthwise convolution. in the input using a depthwise convolution.
Arguments:
channels (int, sequence): Number of channels of the input tensors. Output will Args:
have this number of channels as well. channels (`int` or `sequence`):
kernel_size (int, sequence): Size of the gaussian kernel. Number of channels of the input tensors. The output will have this number of channels as well.
sigma (float, sequence): Standard deviation of the gaussian kernel. kernel_size (`int` or `sequence`):
dim (int, optional): The number of dimensions of the data. Size of the Gaussian kernel.
Default value is 2 (spatial). sigma (`float` or `sequence`):
Standard deviation of the Gaussian kernel.
dim (`int`, *optional*, defaults to `2`):
The number of dimensions of the data. Default is 2 (spatial dimensions).
""" """
def __init__(self, channels, kernel_size, sigma, dim=2): def __init__(self, channels, kernel_size, sigma, dim=2):
...@@ -944,10 +947,14 @@ class GaussianSmoothing(nn.Module): ...@@ -944,10 +947,14 @@ class GaussianSmoothing(nn.Module):
def forward(self, input): def forward(self, input):
""" """
Apply gaussian filter to input. Apply gaussian filter to input.
Arguments:
input (torch.Tensor): Input to apply gaussian filter on. Args:
input (`torch.Tensor` of shape `(N, C, H, W)`):
Input to apply Gaussian filter on.
Returns: Returns:
filtered (torch.Tensor): Filtered output. `torch.Tensor`:
The filtered output tensor with the same shape as the input.
""" """
return self.conv(input, weight=self.weight.to(input.dtype), groups=self.groups, padding="same") return self.conv(input, weight=self.weight.to(input.dtype), groups=self.groups, padding="same")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment