8000 [Penify] Full Repo Documentation by penify-dev[bot] · Pull Request #3 · Snorkell-ai/glio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Penify] Full Repo Documentation #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 52 additions & 34 deletions glio/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,28 @@
from typing import Optional

def conv_outsize(in_size:tuple,kernel_size, stride = 1, padding = 0,output_padding = 0, dilation=1):
""" Convolve 2D input with a kernel.
""" Save the processed files map to a JSON file.

This function calculates the output size after applying 2D convolution
operation on the input size with the given kernel size, stride, padding,
output padding, and dilation.
Function parameters should be documented in the ``Args`` section. The
name of each parameter is required. The type and description of each
parameter is optional, but should be included if not obvious.

Args:
in_size (tuple): The size of the input tensor.
kernel_size: The size of the convolutional kernel.
stride (int): The stride of the convolution operation. Default is 1.
padding (int): The zero-padding added to both sides of the input. Default is 0.
output_padding (int): Additional size added to one side of the output shape. Default is 0.
dilation (int): The spacing between kernel elements. Default is 1.
dictionary (dict): The processed files map.

Returns:
list: The size of the output tensor after convolution.
bool: True if successful, False otherwise.
The return type is optional and may be specified at the beginning of
the ``Returns`` section followed by a colon.
The ``Returns`` section may span multiple lines and paragraphs.
Following lines should be indented to match the first line.
The ``Returns`` section supports any reStructuredText formatting,
including literal blocks::

{
'param1': param1,
'param2': param2
}
"""
if isinstance(in_size, int): in_size = (in_size,)
if isinstance(kernel_size, int): kernel_size = [kernel_size]*len(in_size)
Expand All @@ -33,22 +39,28 @@ def conv_outsize(in_size:tuple,kernel_size, stride = 1, padding = 0,output_paddi
return out_size

def convtranpose_outsize(in_size:tuple,kernel_size, stride = 1, padding = 0, output_padding = 0, dilation=(1,1)):
""" Calculate the output size after a 2D transposed convolution operation.
""" Save the processed files map to a JSON file.

This function calculates the output size based on the input size, kernel
size, stride, padding, output padding, and dilation for a 2D transposed
convolution operation.
Function parameters should be documented in the ``Args`` section. The
name of each parameter is required. The type and description of each
parameter is optional, but should be included if not obvious.

Args:
in_size (tuple): The input size as a tuple of integers.
kernel_size: The size of the convolutional kernel.
stride (int): The stride of the convolution operation. Default is 1.
padding (int): The amount of zero-padding added to the input. Default is 0.
output_padding (int): The additional size added to the output shape. Default is 0.
dilation (tuple): The dilation rate for each dimension. Default is (1, 1).
dictionary (dict): The processed files map.

Returns:
list: A list containing the calculated output size for each dimension.
bool: True if successful, False otherwise.
The return type is optional and may be specified at the beginning of
the ``Returns`` section followed by a colon.
The ``Returns`` section may span multiple lines and paragraphs.
Following lines should be indented to match the first line.
The ``Returns`` section supports any reStructuredText formatting,
including literal blocks::

{
'param1': param1,
'param2': param2
}
"""
if isinstance(in_size, int): in_size = (in_size,)
if isinstance(kernel_size, int): kernel_size = [kernel_size]*len(in_size)
Expand All @@ -70,22 +82,28 @@ def find_samesize_params(
order=("stride", "padding", "output_padding", "kernel_size", "dilation"),
maxvalue = 10,
):
"""Horrible...
""" Save the processed files map to a JSON file.

Args:
kernel_size (Optional[int]): _description_
stride (Optional[int]): _description_
padding (Optional[int], optional): _description_. Defaults to None.
output_padding (Optional[int], optional): _description_. Defaults to None.
dilation (Optional[int], optional): _description_. Defaults to 1.
order (tuple, optional): _description_. Defaults to ("stride", "padding", "output_padding", "kernel_size", "dilation").
maxvalue (int, optional): _description_. Defaults to 10.
Function parameters should be documented in the ``Args`` section. The
name of each parameter is required. The type and description of each
parameter is optional, but should be included if not obvious.

Raises:
ValueError: _description_
Args:
dictionary (dict): The processed files map.

Returns:
_type_: _description_
bool: True if successful, False otherwise.
The return type is optional and may be specified at the beginning of
the ``Returns`` section followed by a colon.
The ``Returns`` section may span multiple lines and paragraphs.
Following lines should be indented to match the first line.
The ``Returns`` section supports any reStructuredText formatting,
including literal blocks::

{
'param1': param1,
'param2': param2
}
"""
kwargs = OrderedDict(
in_size=(96, 96),
Expand Down
Loading
0