synapgrad 1.0.3__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.
- synapgrad-1.0.3/LICENSE +7 -0
- synapgrad-1.0.3/PKG-INFO +137 -0
- synapgrad-1.0.3/README.md +102 -0
- synapgrad-1.0.3/pyproject.toml +58 -0
- synapgrad-1.0.3/setup.cfg +4 -0
- synapgrad-1.0.3/synapgrad/__init__.py +23 -0
- synapgrad-1.0.3/synapgrad/conv_tools.py +602 -0
- synapgrad-1.0.3/synapgrad/cpu_ops.py +604 -0
- synapgrad-1.0.3/synapgrad/device.py +9 -0
- synapgrad-1.0.3/synapgrad/functional.py +1114 -0
- synapgrad-1.0.3/synapgrad/nn/__init__.py +12 -0
- synapgrad-1.0.3/synapgrad/nn/activations.py +107 -0
- synapgrad-1.0.3/synapgrad/nn/functional.py +1008 -0
- synapgrad-1.0.3/synapgrad/nn/init.py +258 -0
- synapgrad-1.0.3/synapgrad/nn/layers.py +630 -0
- synapgrad-1.0.3/synapgrad/nn/losses.py +125 -0
- synapgrad-1.0.3/synapgrad/nn/modules.py +157 -0
- synapgrad-1.0.3/synapgrad/nn/utils/__init__.py +3 -0
- synapgrad-1.0.3/synapgrad/nn/utils/data.py +96 -0
- synapgrad-1.0.3/synapgrad/nn/utils/train.py +253 -0
- synapgrad-1.0.3/synapgrad/optim/__init__.py +2 -0
- synapgrad-1.0.3/synapgrad/optim/optimizers.py +190 -0
- synapgrad-1.0.3/synapgrad/tensor.py +572 -0
- synapgrad-1.0.3/synapgrad/utils.py +80 -0
- synapgrad-1.0.3/synapgrad/visual/__init__.py +1 -0
- synapgrad-1.0.3/synapgrad/visual/graph.py +54 -0
- synapgrad-1.0.3/synapgrad.egg-info/PKG-INFO +137 -0
- synapgrad-1.0.3/synapgrad.egg-info/SOURCES.txt +37 -0
- synapgrad-1.0.3/synapgrad.egg-info/dependency_links.txt +1 -0
- synapgrad-1.0.3/synapgrad.egg-info/requires.txt +6 -0
- synapgrad-1.0.3/synapgrad.egg-info/top_level.txt +1 -0
- synapgrad-1.0.3/tests/test_activations.py +55 -0
- synapgrad-1.0.3/tests/test_engine.py +230 -0
- synapgrad-1.0.3/tests/test_initializers.py +130 -0
- synapgrad-1.0.3/tests/test_layers.py +423 -0
- synapgrad-1.0.3/tests/test_losses.py +130 -0
- synapgrad-1.0.3/tests/test_ops.py +257 -0
- synapgrad-1.0.3/tests/test_optimizers.py +87 -0
- synapgrad-1.0.3/tests/test_training.py +74 -0
synapgrad-1.0.3/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
The MIT License (MIT) Copyright (c) 2020 Andrej Karpathy
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
synapgrad-1.0.3/PKG-INFO
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: synapgrad
|
|
3
|
+
Version: 1.0.3
|
|
4
|
+
Summary: A lightweight autograd engine with a deep learning library and a Torch-like API
|
|
5
|
+
Author-email: Pablo García Mesa <pgmesa.sm@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/pgmesa/synapgrad
|
|
8
|
+
Keywords: Autograd,Tensor,Machine Learning,Deep Learning,Python
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Intended Audience :: Education
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Topic :: Software Development
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
|
+
Requires-Python: >=3.9
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: numpy<3.0.0,>=1.23.0
|
|
30
|
+
Provides-Extra: train
|
|
31
|
+
Requires-Dist: tqdm<5.0.0,>=4.0.0; extra == "train"
|
|
32
|
+
Requires-Dist: matplotlib<4.0.0,>=3.0.0; extra == "train"
|
|
33
|
+
Requires-Dist: scikit-learn<2.0.0,>=1.2.1; extra == "train"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# SynapGrad
|
|
37
|
+
|
|
38
|
+
A lightweight autograd engine with a deep learning library and a Torch-like API, built from scratch.
|
|
39
|
+
|
|
40
|
+
[](https://pepy.tech/project/synapgrad)
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
_Python ≥ `3.9`_
|
|
44
|
+
```bash
|
|
45
|
+
pip install synapgrad
|
|
46
|
+
```
|
|
47
|
+
## Technical Description
|
|
48
|
+
This project implements a completely functional engine for tracking operations between Tensors, by dynamically building a Directed Acyclic Graph (DAG), and an automatic gradient calculation and backpropagation algorithm (reverse-mode autodiff) over this DAG.
|
|
49
|
+
|
|
50
|
+
Built on top of the engine, the deep learning library implements the most common functions, layers, losses and optimizers in order to create AI models able to solve real problems. This library mimics PyTorch in a simplified way, with the same API style and function names.
|
|
51
|
+
|
|
52
|
+
## Aim of the project
|
|
53
|
+
The objective of this project is to develop a lightweight deep learning library entirely from scratch, without relying on any existing frameworks (such as Keras, PyTorch, TensorFlow, scikit-learn, etc.), using only the `numpy` library.
|
|
54
|
+
|
|
55
|
+
> At the moment, supporting GPU execution is not within the scope of the project
|
|
56
|
+
|
|
57
|
+
## Autograd Engine
|
|
58
|
+
Automatic gradient calculation and backpropagation algorithm
|
|
59
|
+
|
|
60
|
+
### Requirements
|
|
61
|
+
```r
|
|
62
|
+
numpy>=1.23.0,<3.0.0 # Core
|
|
63
|
+
graphviz==0.20.1 # (Optional) Visualize DAG (https://graphviz.org/download/)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
In the `examples/visualize_graph.ipynb` notebook there is an example of how to display the graph that synapgrad creates in the background as operations are chained:
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
import synapgrad
|
|
70
|
+
|
|
71
|
+
with synapgrad.retain_grads():
|
|
72
|
+
x1 = synapgrad.tensor([[-5.0, 3.0], [2.0, -4.0]], requires_grad=True)
|
|
73
|
+
x2 = synapgrad.tensor([[6.0, 0.4], [1.9, 2.0]], requires_grad=True)
|
|
74
|
+
x3 = synapgrad.tensor(3.0, requires_grad=True)
|
|
75
|
+
y = synapgrad.addmm(x3, x1, x2) # x3 + x1 @ x2
|
|
76
|
+
z = x2.sqrt() @ y
|
|
77
|
+
z.backward(synapgrad.ones(z.shape))
|
|
78
|
+
|
|
79
|
+
# graphviz is required to draw the graph
|
|
80
|
+
z.draw_graph()
|
|
81
|
+
```
|
|
82
|
+

|
|
83
|
+
|
|
84
|
+
## Deep learning library
|
|
85
|
+
Built on top of the engine, synapgrad has a deep learning library that implements the following features:
|
|
86
|
+
|
|
87
|
+
- `Weight initialization`: Xavier Glorot uniform, Xavier Glorot normal, He Kaiming uniform, He Kaiming normal
|
|
88
|
+
- `Activations`: ReLU, LeakyReLU, SELU, Tanh, Sigmoid, Softmax, LogSoftmax
|
|
89
|
+
- `Layers`: Linear, Unfold, Fold, Flatten, Dropout
|
|
90
|
+
- `Convolutions`: MaxPool1d, MaxPool2d, AvgPool1d, AvgPool2d, Conv1d, Conv2d
|
|
91
|
+
- `Normalizations`: BatchNorm1d, BatchNorm2d
|
|
92
|
+
- `Optimizers`: SGD, Adam, AdamW
|
|
93
|
+
- `Losses`: MSELoss, NLLLoss, BCELoss, BCEWithLogitsLoss, CrossEntropyLoss
|
|
94
|
+
|
|
95
|
+
This project includes three Jupyter notebooks (located in `examples/`) that tackle three beginner-level AI problems:
|
|
96
|
+
|
|
97
|
+
- [x] 1. Basic MLP for binary classification (sklearn 'make_moons' toy dataset)
|
|
98
|
+
- [x] 2. MLP for handwritten digits classification (MNIST dataset)
|
|
99
|
+
- [x] 3. CNN for handwritten digits classification (MNIST dataset)
|
|
100
|
+
|
|
101
|
+
### Extra requirements
|
|
102
|
+
To use the SynapGrad training utilities, install the optional requirements by running:
|
|
103
|
+
```bash
|
|
104
|
+
pip install synapgrad[train]
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Additionally to run the notebooks in `/examples` you will need to install:
|
|
108
|
+
```r
|
|
109
|
+
torchvision>=0.13.1
|
|
110
|
+
# **** torch required only if you want to use torch engine instead of synapgrad's *****
|
|
111
|
+
torch>=1.12.1,<3.0.0 # Install following the instructions in https://pytorch.org/
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Comparisons with PyTorch
|
|
115
|
+
To measure the efficiency of synapgrad, all three examples were compared to PyTorch 2.14. All training sessions were conducted on a Ryzen 7 9700X (8 cores). The times are those of `trainer.fit`, training plus the validation pass of every epoch.
|
|
116
|
+
|
|
117
|
+
| Notebook | torch | synapgrad | Model params | Dataset size | Batch size | Epochs |
|
|
118
|
+
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
119
|
+
| basic_mlp.ipynb | 1.4 s | 0.26 s | 337 | [150, 2] | 4 | 50 |
|
|
120
|
+
| mnist_mlp.ipynb | 4.5 s | 9.7 s | 178_110 | [48_000, 28, 28] | 64 | 10 |
|
|
121
|
+
| mnist_cnn.ipynb | 37.8 s | 4 min 55 s | 20_538 | [48_000, 1, 28, 28] | 128 | 5 |
|
|
122
|
+
|
|
123
|
+
## Running tests
|
|
124
|
+
|
|
125
|
+
To run the unit tests you will have to install Pytest and PyTorch, which is used to check whether the gradients are calculated correctly
|
|
126
|
+
```r
|
|
127
|
+
pytest>=8.0.0,<9.0.0
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Run all the tests:
|
|
131
|
+
```bash
|
|
132
|
+
python -m pytest
|
|
133
|
+
```
|
|
134
|
+
To compare the speed of `torch` and `synapgrad` in each operation, run the command below:
|
|
135
|
+
```
|
|
136
|
+
python -m pytest ./tests/test_ops.py -s
|
|
137
|
+
```
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# SynapGrad
|
|
2
|
+
|
|
3
|
+
A lightweight autograd engine with a deep learning library and a Torch-like API, built from scratch.
|
|
4
|
+
|
|
5
|
+
[](https://pepy.tech/project/synapgrad)
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
_Python ≥ `3.9`_
|
|
9
|
+
```bash
|
|
10
|
+
pip install synapgrad
|
|
11
|
+
```
|
|
12
|
+
## Technical Description
|
|
13
|
+
This project implements a completely functional engine for tracking operations between Tensors, by dynamically building a Directed Acyclic Graph (DAG), and an automatic gradient calculation and backpropagation algorithm (reverse-mode autodiff) over this DAG.
|
|
14
|
+
|
|
15
|
+
Built on top of the engine, the deep learning library implements the most common functions, layers, losses and optimizers in order to create AI models able to solve real problems. This library mimics PyTorch in a simplified way, with the same API style and function names.
|
|
16
|
+
|
|
17
|
+
## Aim of the project
|
|
18
|
+
The objective of this project is to develop a lightweight deep learning library entirely from scratch, without relying on any existing frameworks (such as Keras, PyTorch, TensorFlow, scikit-learn, etc.), using only the `numpy` library.
|
|
19
|
+
|
|
20
|
+
> At the moment, supporting GPU execution is not within the scope of the project
|
|
21
|
+
|
|
22
|
+
## Autograd Engine
|
|
23
|
+
Automatic gradient calculation and backpropagation algorithm
|
|
24
|
+
|
|
25
|
+
### Requirements
|
|
26
|
+
```r
|
|
27
|
+
numpy>=1.23.0,<3.0.0 # Core
|
|
28
|
+
graphviz==0.20.1 # (Optional) Visualize DAG (https://graphviz.org/download/)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
In the `examples/visualize_graph.ipynb` notebook there is an example of how to display the graph that synapgrad creates in the background as operations are chained:
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
import synapgrad
|
|
35
|
+
|
|
36
|
+
with synapgrad.retain_grads():
|
|
37
|
+
x1 = synapgrad.tensor([[-5.0, 3.0], [2.0, -4.0]], requires_grad=True)
|
|
38
|
+
x2 = synapgrad.tensor([[6.0, 0.4], [1.9, 2.0]], requires_grad=True)
|
|
39
|
+
x3 = synapgrad.tensor(3.0, requires_grad=True)
|
|
40
|
+
y = synapgrad.addmm(x3, x1, x2) # x3 + x1 @ x2
|
|
41
|
+
z = x2.sqrt() @ y
|
|
42
|
+
z.backward(synapgrad.ones(z.shape))
|
|
43
|
+
|
|
44
|
+
# graphviz is required to draw the graph
|
|
45
|
+
z.draw_graph()
|
|
46
|
+
```
|
|
47
|
+

|
|
48
|
+
|
|
49
|
+
## Deep learning library
|
|
50
|
+
Built on top of the engine, synapgrad has a deep learning library that implements the following features:
|
|
51
|
+
|
|
52
|
+
- `Weight initialization`: Xavier Glorot uniform, Xavier Glorot normal, He Kaiming uniform, He Kaiming normal
|
|
53
|
+
- `Activations`: ReLU, LeakyReLU, SELU, Tanh, Sigmoid, Softmax, LogSoftmax
|
|
54
|
+
- `Layers`: Linear, Unfold, Fold, Flatten, Dropout
|
|
55
|
+
- `Convolutions`: MaxPool1d, MaxPool2d, AvgPool1d, AvgPool2d, Conv1d, Conv2d
|
|
56
|
+
- `Normalizations`: BatchNorm1d, BatchNorm2d
|
|
57
|
+
- `Optimizers`: SGD, Adam, AdamW
|
|
58
|
+
- `Losses`: MSELoss, NLLLoss, BCELoss, BCEWithLogitsLoss, CrossEntropyLoss
|
|
59
|
+
|
|
60
|
+
This project includes three Jupyter notebooks (located in `examples/`) that tackle three beginner-level AI problems:
|
|
61
|
+
|
|
62
|
+
- [x] 1. Basic MLP for binary classification (sklearn 'make_moons' toy dataset)
|
|
63
|
+
- [x] 2. MLP for handwritten digits classification (MNIST dataset)
|
|
64
|
+
- [x] 3. CNN for handwritten digits classification (MNIST dataset)
|
|
65
|
+
|
|
66
|
+
### Extra requirements
|
|
67
|
+
To use the SynapGrad training utilities, install the optional requirements by running:
|
|
68
|
+
```bash
|
|
69
|
+
pip install synapgrad[train]
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Additionally to run the notebooks in `/examples` you will need to install:
|
|
73
|
+
```r
|
|
74
|
+
torchvision>=0.13.1
|
|
75
|
+
# **** torch required only if you want to use torch engine instead of synapgrad's *****
|
|
76
|
+
torch>=1.12.1,<3.0.0 # Install following the instructions in https://pytorch.org/
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Comparisons with PyTorch
|
|
80
|
+
To measure the efficiency of synapgrad, all three examples were compared to PyTorch 2.14. All training sessions were conducted on a Ryzen 7 9700X (8 cores). The times are those of `trainer.fit`, training plus the validation pass of every epoch.
|
|
81
|
+
|
|
82
|
+
| Notebook | torch | synapgrad | Model params | Dataset size | Batch size | Epochs |
|
|
83
|
+
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
84
|
+
| basic_mlp.ipynb | 1.4 s | 0.26 s | 337 | [150, 2] | 4 | 50 |
|
|
85
|
+
| mnist_mlp.ipynb | 4.5 s | 9.7 s | 178_110 | [48_000, 28, 28] | 64 | 10 |
|
|
86
|
+
| mnist_cnn.ipynb | 37.8 s | 4 min 55 s | 20_538 | [48_000, 1, 28, 28] | 128 | 5 |
|
|
87
|
+
|
|
88
|
+
## Running tests
|
|
89
|
+
|
|
90
|
+
To run the unit tests you will have to install Pytest and PyTorch, which is used to check whether the gradients are calculated correctly
|
|
91
|
+
```r
|
|
92
|
+
pytest>=8.0.0,<9.0.0
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Run all the tests:
|
|
96
|
+
```bash
|
|
97
|
+
python -m pytest
|
|
98
|
+
```
|
|
99
|
+
To compare the speed of `torch` and `synapgrad` in each operation, run the command below:
|
|
100
|
+
```
|
|
101
|
+
python -m pytest ./tests/test_ops.py -s
|
|
102
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "synapgrad"
|
|
7
|
+
version = "1.0.3"
|
|
8
|
+
description = "A lightweight autograd engine with a deep learning library and a Torch-like API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
urls = {Homepage = "https://github.com/pgmesa/synapgrad"}
|
|
13
|
+
keywords = ["Autograd", "Tensor", "Machine Learning", "Deep Learning", "Python"]
|
|
14
|
+
authors = [
|
|
15
|
+
{name = "Pablo García Mesa", email = "pgmesa.sm@gmail.com"}
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
dependencies = [
|
|
19
|
+
"numpy>=1.23.0,<3.0.0",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
classifiers = [
|
|
23
|
+
"Development Status :: 5 - Production/Stable",
|
|
24
|
+
|
|
25
|
+
"Intended Audience :: Developers",
|
|
26
|
+
"Intended Audience :: Education",
|
|
27
|
+
"Intended Audience :: Science/Research",
|
|
28
|
+
|
|
29
|
+
"License :: OSI Approved :: MIT License",
|
|
30
|
+
|
|
31
|
+
"Operating System :: OS Independent",
|
|
32
|
+
|
|
33
|
+
"Programming Language :: Python :: 3",
|
|
34
|
+
"Programming Language :: Python :: 3.9",
|
|
35
|
+
"Programming Language :: Python :: 3.10",
|
|
36
|
+
"Programming Language :: Python :: 3.11",
|
|
37
|
+
"Programming Language :: Python :: 3.12",
|
|
38
|
+
|
|
39
|
+
"Topic :: Scientific/Engineering",
|
|
40
|
+
"Topic :: Scientific/Engineering :: Mathematics",
|
|
41
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
42
|
+
"Topic :: Software Development",
|
|
43
|
+
"Topic :: Software Development :: Libraries",
|
|
44
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[project.optional-dependencies]
|
|
48
|
+
train = [
|
|
49
|
+
"tqdm>=4.0.0,<5.0.0",
|
|
50
|
+
"matplotlib>=3.0.0,<4.0.0",
|
|
51
|
+
"scikit-learn>=1.2.1,<2.0.0"
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
[tool.setuptools]
|
|
55
|
+
packages = { find = { where = ["."], include = ["synapgrad", "synapgrad.*"]} }
|
|
56
|
+
|
|
57
|
+
[tool.test]
|
|
58
|
+
framework = "pytest"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from synapgrad.tensor import (
|
|
2
|
+
Tensor, tensor, empty, ones, ones_like, zeros, zeros_like,
|
|
3
|
+
arange, rand, randn, normal, randint, eye, no_grad,
|
|
4
|
+
retain_grads, no_grad
|
|
5
|
+
)
|
|
6
|
+
from synapgrad.functional import (
|
|
7
|
+
add, mul, matmul, addmm, pow, rpow, neg, slice,
|
|
8
|
+
concat, stack, unbind,
|
|
9
|
+
clone, exp, log, sqrt, sum, mean, max, min, squeeze, unsqueeze,
|
|
10
|
+
reshape, movedim, transpose, flatten, unfold_dim
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
from synapgrad.utils import manual_seed
|
|
14
|
+
|
|
15
|
+
from synapgrad.nn.functional import (
|
|
16
|
+
relu, leaky_relu, selu, tanh, sigmoid, softmax, log_softmax,
|
|
17
|
+
mse_loss, nll_loss, binary_cross_entropy, binary_cross_entropy_with_logits, cross_entropy,
|
|
18
|
+
linear, unfold, fold, max_pool1d, max_pool2d, avg_pool1d, avg_pool2d, conv1d, conv2d, batch_norm
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
from synapgrad import (
|
|
22
|
+
cpu_ops, conv_tools, device, functional, nn, optim, utils, visual
|
|
23
|
+
)
|