torchlab-pytorch 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 TorchLab contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.4
2
+ Name: torchlab-pytorch
3
+ Version: 0.1.1
4
+ Summary: A research-oriented collection of PyTorch activation functions, loss functions, and optimizers.
5
+ Author: Dilyan Grigorov
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/didogrigorov/torchlab
8
+ Project-URL: Repository, https://github.com/didogrigorov/torchlab
9
+ Project-URL: Issues, https://github.com/didogrigorov/torchlab/issues
10
+ Keywords: pytorch,deep-learning,machine-learning,activation-functions,loss-functions,optimizers
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: torch>=2.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=8; extra == "dev"
25
+ Requires-Dist: build>=1.2; extra == "dev"
26
+ Requires-Dist: twine>=5; extra == "dev"
27
+ Requires-Dist: numpy>=1.26; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ # TorchLab
31
+
32
+ TorchLab is a research-oriented PyTorch library collecting activation functions,
33
+ loss functions, and optimization algorithms that are useful for experimentation
34
+ with neural networks.
35
+
36
+ The project is intended to make a broad set of published methods available behind
37
+ a consistent PyTorch-style API.
38
+
39
+ ## Package layout
40
+
41
+ ```text
42
+ src/
43
+ └── torchlab/
44
+ ├── __init__.py
45
+ ├── activations/
46
+ │ ├── __init__.py
47
+ │ ├── classic.py
48
+ │ └── adaptive.py
49
+ ├── losses/
50
+ │ ├── __init__.py
51
+ │ └── losses.py
52
+ └── optimizers/
53
+ ├── __init__.py
54
+ └── optimizers.py
55
+ ```
56
+
57
+ ## Installation for development
58
+
59
+ Create and activate a virtual environment, then install TorchLab in editable mode:
60
+
61
+ ```bash
62
+ python -m pip install --upgrade pip
63
+ python -m pip install -e ".[dev]"
64
+ ```
65
+
66
+ Run the test suite:
67
+
68
+ ```bash
69
+ pytest -q
70
+ ```
71
+
72
+ ## Basic usage
73
+
74
+ ```python
75
+ import torch
76
+
77
+ from torchlab.activations.classic import GELU
78
+ from torchlab.activations.adaptive import Swish
79
+ from torchlab.losses import DiceLoss
80
+ from torchlab.optimizers import Lion
81
+
82
+ x = torch.randn(8, 32)
83
+ y = GELU()(x)
84
+ z = Swish()(x)
85
+
86
+ print(y.shape, z.shape)
87
+ ```
88
+
89
+ Optimizer example:
90
+
91
+ ```python
92
+ import torch
93
+ from torchlab.optimizers import Lion
94
+
95
+ model = torch.nn.Linear(10, 1)
96
+ optimizer = Lion(model.parameters(), lr=1e-4)
97
+
98
+ x = torch.randn(32, 10)
99
+ target = torch.randn(32, 1)
100
+
101
+ prediction = model(x)
102
+ loss = torch.nn.functional.mse_loss(prediction, target)
103
+
104
+ optimizer.zero_grad()
105
+ loss.backward()
106
+ optimizer.step()
107
+ ```
108
+
109
+ ## Testing a source checkout
110
+
111
+ From the repository root:
112
+
113
+ ```bash
114
+ python -m pip install -e ".[dev]"
115
+ pytest -q
116
+ ```
117
+
118
+ For a clean wheel test:
119
+
120
+ ```bash
121
+ python -m build
122
+ python -m twine check --strict dist/*
123
+ python -m pip install --force-reinstall dist/torchlab-*.whl
124
+ ```
125
+
126
+ ## Documentation
127
+
128
+ Project documentation can be hosted with GitHub Pages from the `docs/` directory.
129
+
130
+ ## Research-code note
131
+
132
+ TorchLab contains implementations of methods described in research literature.
133
+ Some algorithms require special training-loop behavior, parameter constraints, or
134
+ approximations. Consult the project documentation and mathematical audit before
135
+ using unfamiliar methods in production.
136
+
137
+ ## License
138
+
139
+ TorchLab is released under the MIT License. See `LICENSE`.
@@ -0,0 +1,110 @@
1
+ # TorchLab
2
+
3
+ TorchLab is a research-oriented PyTorch library collecting activation functions,
4
+ loss functions, and optimization algorithms that are useful for experimentation
5
+ with neural networks.
6
+
7
+ The project is intended to make a broad set of published methods available behind
8
+ a consistent PyTorch-style API.
9
+
10
+ ## Package layout
11
+
12
+ ```text
13
+ src/
14
+ └── torchlab/
15
+ ├── __init__.py
16
+ ├── activations/
17
+ │ ├── __init__.py
18
+ │ ├── classic.py
19
+ │ └── adaptive.py
20
+ ├── losses/
21
+ │ ├── __init__.py
22
+ │ └── losses.py
23
+ └── optimizers/
24
+ ├── __init__.py
25
+ └── optimizers.py
26
+ ```
27
+
28
+ ## Installation for development
29
+
30
+ Create and activate a virtual environment, then install TorchLab in editable mode:
31
+
32
+ ```bash
33
+ python -m pip install --upgrade pip
34
+ python -m pip install -e ".[dev]"
35
+ ```
36
+
37
+ Run the test suite:
38
+
39
+ ```bash
40
+ pytest -q
41
+ ```
42
+
43
+ ## Basic usage
44
+
45
+ ```python
46
+ import torch
47
+
48
+ from torchlab.activations.classic import GELU
49
+ from torchlab.activations.adaptive import Swish
50
+ from torchlab.losses import DiceLoss
51
+ from torchlab.optimizers import Lion
52
+
53
+ x = torch.randn(8, 32)
54
+ y = GELU()(x)
55
+ z = Swish()(x)
56
+
57
+ print(y.shape, z.shape)
58
+ ```
59
+
60
+ Optimizer example:
61
+
62
+ ```python
63
+ import torch
64
+ from torchlab.optimizers import Lion
65
+
66
+ model = torch.nn.Linear(10, 1)
67
+ optimizer = Lion(model.parameters(), lr=1e-4)
68
+
69
+ x = torch.randn(32, 10)
70
+ target = torch.randn(32, 1)
71
+
72
+ prediction = model(x)
73
+ loss = torch.nn.functional.mse_loss(prediction, target)
74
+
75
+ optimizer.zero_grad()
76
+ loss.backward()
77
+ optimizer.step()
78
+ ```
79
+
80
+ ## Testing a source checkout
81
+
82
+ From the repository root:
83
+
84
+ ```bash
85
+ python -m pip install -e ".[dev]"
86
+ pytest -q
87
+ ```
88
+
89
+ For a clean wheel test:
90
+
91
+ ```bash
92
+ python -m build
93
+ python -m twine check --strict dist/*
94
+ python -m pip install --force-reinstall dist/torchlab-*.whl
95
+ ```
96
+
97
+ ## Documentation
98
+
99
+ Project documentation can be hosted with GitHub Pages from the `docs/` directory.
100
+
101
+ ## Research-code note
102
+
103
+ TorchLab contains implementations of methods described in research literature.
104
+ Some algorithms require special training-loop behavior, parameter constraints, or
105
+ approximations. Consult the project documentation and mathematical audit before
106
+ using unfamiliar methods in production.
107
+
108
+ ## License
109
+
110
+ TorchLab is released under the MIT License. See `LICENSE`.
@@ -0,0 +1,56 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "torchlab-pytorch"
7
+ version = "0.1.1"
8
+ description = "A research-oriented collection of PyTorch activation functions, loss functions, and optimizers."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ authors = [
13
+ { name = "Dilyan Grigorov" }
14
+ ]
15
+ keywords = [
16
+ "pytorch",
17
+ "deep-learning",
18
+ "machine-learning",
19
+ "activation-functions",
20
+ "loss-functions",
21
+ "optimizers"
22
+ ]
23
+ classifiers = [
24
+ "Development Status :: 3 - Alpha",
25
+ "Intended Audience :: Developers",
26
+ "Intended Audience :: Science/Research",
27
+ "Programming Language :: Python :: 3",
28
+ "Programming Language :: Python :: 3.10",
29
+ "Programming Language :: Python :: 3.11",
30
+ "Programming Language :: Python :: 3.12",
31
+ "Topic :: Scientific/Engineering :: Artificial Intelligence"
32
+ ]
33
+ dependencies = [
34
+ "torch>=2.0"
35
+ ]
36
+
37
+ [project.optional-dependencies]
38
+ dev = [
39
+ "pytest>=8",
40
+ "build>=1.2",
41
+ "twine>=5",
42
+ "numpy>=1.26"
43
+ ]
44
+
45
+ # Replace YOUR_USERNAME after you create the GitHub repository.
46
+ [project.urls]
47
+ Homepage = "https://github.com/didogrigorov/torchlab"
48
+ Repository = "https://github.com/didogrigorov/torchlab"
49
+ Issues = "https://github.com/didogrigorov/torchlab/issues"
50
+
51
+ [tool.setuptools.packages.find]
52
+ where = ["src"]
53
+
54
+ [tool.pytest.ini_options]
55
+ testpaths = ["tests"]
56
+ addopts = "-ra"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,8 @@
1
+ from .classic import *
2
+ from .adaptive import *
3
+
4
+ __all__ = [
5
+ name
6
+ for name in globals()
7
+ if not name.startswith("_")
8
+ ]