-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use typing.Literal for boundary mode, padding mode, and orthogonaliza…
…tion mode (#77)
- Loading branch information
Showing
18 changed files
with
227 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"""Constants and types used throughout the PyTorch Wavelet Toolbox.""" | ||
|
||
from typing import Literal, Union | ||
|
||
__all__ = [ | ||
"BoundaryMode", | ||
"ExtendedBoundaryMode", | ||
"PaddingMode", | ||
"OrthogonalizeMethod", | ||
] | ||
|
||
BoundaryMode = Literal["constant", "zero", "reflect", "periodic", "symmetric"] | ||
""" | ||
This is a type literal for the way of padding. | ||
- Refection padding mirrors samples along the border. | ||
- Zero padding pads zeros. | ||
- Constant padding replicates border values. | ||
- Periodic padding cyclically repeats samples. | ||
- Symmetric padding mirrors samples along the border | ||
""" | ||
|
||
ExtendedBoundaryMode = Union[Literal["boundary"], BoundaryMode] | ||
|
||
PaddingMode = Literal["full", "valid", "same", "sameshift"] | ||
""" | ||
The padding mode is used when construction convolution matrices. | ||
""" | ||
|
||
OrthogonalizeMethod = Literal["qr", "gramschmidt"] | ||
""" | ||
The method for orthogonalizing a matrix. | ||
1. 'qr' relies on pytorch's dense qr implementation, it is fast but memory hungry. | ||
2. 'gramschmidt' option is sparse, memory efficient, and slow. | ||
Choose 'gramschmidt' if 'qr' runs out of memory. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.