-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from kozistr/docs/docstring
[Refactor/Docs] Organize Class docstring & Add custom exceptions
- Loading branch information
Showing
37 changed files
with
740 additions
and
589 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
Implemented Optimizers | ||
==================== | ||
|
||
.. _AdaBelief: | ||
|
||
AdaBelief | ||
--------- | ||
|
||
.. autoclass:: pytorch_optimizer.AdaBelief | ||
:members: | ||
|
||
.. _AdaBound: | ||
|
||
AdaBound | ||
-------- | ||
|
||
.. autoclass:: pytorch_optimizer.AdaBound | ||
:members: | ||
|
||
.. _Adai: | ||
|
||
Adai | ||
---- | ||
|
||
.. autoclass:: pytorch_optimizer.Adai | ||
:members: | ||
|
||
.. _AdamP: | ||
|
||
AdamP | ||
----- | ||
|
||
.. autoclass:: pytorch_optimizer.AdamP | ||
:members: | ||
|
||
.. _Adan: | ||
|
||
Adan | ||
---- | ||
|
||
.. autoclass:: pytorch_optimizer.Adan | ||
:members: | ||
|
||
.. _AdaPNM: | ||
|
||
AdaPNM | ||
------ | ||
|
||
.. autoclass:: pytorch_optimizer.AdaPNM | ||
:members: | ||
|
||
.. _AGC: | ||
|
||
AGC | ||
--- | ||
|
||
.. autoclass:: pytorch_optimizer.AGC | ||
:members: | ||
|
||
.. _diffGrad: | ||
|
||
diffGrad | ||
-------- | ||
|
||
.. autoclass:: pytorch_optimizer.DiffGrad | ||
:members: | ||
|
||
.. _diffRGrad: | ||
|
||
diffRGrad | ||
--------- | ||
|
||
.. autoclass:: pytorch_optimizer.DiffRGrad | ||
:members: | ||
|
||
.. _GC: | ||
|
||
GC | ||
-- | ||
|
||
.. autoclass:: pytorch_optimizer.centralize_gradient | ||
:members: | ||
|
||
.. _Lamb: | ||
|
||
Lamb | ||
---- | ||
|
||
.. autoclass:: pytorch_optimizer.Lamb | ||
:members: | ||
|
||
.. _LARS: | ||
|
||
LARS | ||
---- | ||
|
||
.. autoclass:: pytorch_optimizer.LARS | ||
:members: | ||
|
||
.. _Lookahead: | ||
|
||
Lookahead | ||
--------- | ||
|
||
.. autoclass:: pytorch_optimizer.Lookahead | ||
:members: | ||
|
||
.. _MADGRAD: | ||
|
||
MADGRAD | ||
------- | ||
|
||
.. autoclass:: pytorch_optimizer.MADGRAD | ||
:members: | ||
|
||
.. _Nero: | ||
|
||
Nero | ||
---- | ||
|
||
.. autoclass:: pytorch_optimizer.Nero | ||
:members: | ||
|
||
.. _PCGrad: | ||
|
||
PCGrad | ||
------ | ||
|
||
.. autoclass:: pytorch_optimizer.PCGrad | ||
:members: | ||
|
||
.. _PNM: | ||
|
||
PNM | ||
--- | ||
|
||
.. autoclass:: pytorch_optimizer.PNM | ||
:members: | ||
|
||
.. _RAdam: | ||
|
||
RAdam | ||
----- | ||
|
||
.. autoclass:: pytorch_optimizer.RAdam | ||
:members: | ||
|
||
.. _RaLamb: | ||
|
||
RaLamb | ||
------ | ||
|
||
.. autoclass:: pytorch_optimizer.RaLamb | ||
:members: | ||
|
||
.. _Ranger: | ||
|
||
Ranger | ||
------ | ||
|
||
.. autoclass:: pytorch_optimizer.Ranger | ||
:members: | ||
|
||
.. _Ranger21: | ||
|
||
Ranger21 | ||
-------- | ||
|
||
.. autoclass:: pytorch_optimizer.Ranger21 | ||
:members: | ||
|
||
.. _SAM: | ||
|
||
SAM | ||
--- | ||
|
||
.. autoclass:: pytorch_optimizer.SAM | ||
:members: | ||
|
||
.. _SGDP: | ||
|
||
SGDP | ||
---- | ||
|
||
.. autoclass:: pytorch_optimizer.SGDP | ||
:members: | ||
|
||
.. _Shampoo: | ||
|
||
Shampoo | ||
------- | ||
|
||
.. autoclass:: pytorch_optimizer.Shampoo | ||
:members: |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "pytorch_optimizer" | ||
version = "2.1.0" | ||
version = "2.1.1" | ||
description = "Bunch of optimizer implementations in PyTorch with clean-code, strict types. Also, including useful optimization ideas." | ||
license = "Apache-2.0" | ||
authors = ["kozistr <[email protected]>"] | ||
|
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,27 @@ | ||
class NoSparseGradientError(Exception): | ||
"""Raised when the gradient is sparse gradient | ||
:param optimizer_name: str. optimizer name. | ||
:param note: str. special conditions to note (default ''). | ||
""" | ||
|
||
def __init__(self, optimizer_name: str, note: str = ''): | ||
self.note: str = ' ' if note == '' else f' w/ {note} ' | ||
self.message: str = f'[-] {optimizer_name}{self.note}does not support sparse gradient.' | ||
super().__init__(self.message) | ||
|
||
|
||
class ZeroParameterSizeError(Exception): | ||
"""Raised when the parameter size is 0""" | ||
|
||
def __init__(self): | ||
self.message: str = '[-] parameter size is 0' | ||
super().__init__(self.message) | ||
|
||
|
||
class NoClosureError(Exception): | ||
"""Raised when there's no closure function""" | ||
|
||
def __init__(self, optimizer_name: str): | ||
self.message: str = f'[-] {optimizer_name} requires closure.' | ||
super().__init__(self.message) |
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.