netlite 0.0.6__tar.gz → 0.0.7__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.
Files changed (24) hide show
  1. {netlite-0.0.6 → netlite-0.0.7}/PKG-INFO +1 -1
  2. {netlite-0.0.6 → netlite-0.0.7}/pyproject.toml +1 -1
  3. {netlite-0.0.6 → netlite-0.0.7}/src/netlite/layers.py +1 -1
  4. netlite-0.0.7/src/netlite/numba_optional.py +26 -0
  5. {netlite-0.0.6 → netlite-0.0.7}/.gitignore +0 -0
  6. {netlite-0.0.6 → netlite-0.0.7}/LICENSE +0 -0
  7. {netlite-0.0.6 → netlite-0.0.7}/README.md +0 -0
  8. {netlite-0.0.6 → netlite-0.0.7}/examples/netlite_example_fit_regression_line.py +0 -0
  9. {netlite-0.0.6 → netlite-0.0.7}/examples/netlite_example_lenet_cifar10.py +0 -0
  10. {netlite-0.0.6 → netlite-0.0.7}/examples/netlite_example_lenet_mnist.py +0 -0
  11. {netlite-0.0.6 → netlite-0.0.7}/examples/netlite_example_xor_classifier.py +0 -0
  12. {netlite-0.0.6 → netlite-0.0.7}/images/lenet_mnist_acc_curves.svg +0 -0
  13. {netlite-0.0.6 → netlite-0.0.7}/images/logo_netlite.png +0 -0
  14. {netlite-0.0.6 → netlite-0.0.7}/package_build.sh +0 -0
  15. {netlite-0.0.6 → netlite-0.0.7}/package_upload.sh +0 -0
  16. {netlite-0.0.6 → netlite-0.0.7}/requirements.txt +0 -0
  17. {netlite-0.0.6 → netlite-0.0.7}/src/netlite/__init__.py +0 -0
  18. {netlite-0.0.6 → netlite-0.0.7}/src/netlite/dataloader_cifar10.py +0 -0
  19. {netlite-0.0.6 → netlite-0.0.7}/src/netlite/dataloader_mnist.py +0 -0
  20. {netlite-0.0.6 → netlite-0.0.7}/src/netlite/loss_functions.py +0 -0
  21. {netlite-0.0.6 → netlite-0.0.7}/src/netlite/neural_network.py +0 -0
  22. {netlite-0.0.6 → netlite-0.0.7}/src/netlite/optimizer.py +0 -0
  23. {netlite-0.0.6 → netlite-0.0.7}/tests/netlite_test.py +0 -0
  24. {netlite-0.0.6 → netlite-0.0.7}/tests/netlite_test_convolution.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: netlite
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: A small white-box training framework for neural networks for education.
5
5
  Project-URL: Homepage, https://github.com/haho12/netlite
6
6
  Project-URL: Issues, https://github.com/haho12/netlite/issues
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "netlite"
7
- version = "0.0.6"
7
+ version = "0.0.7"
8
8
  authors = [
9
9
  { name="Hanno Homann", email="hanno.homann@example.com" },
10
10
  ]
@@ -1,5 +1,5 @@
1
1
  import numpy as np
2
- import numba
2
+ from netlite.numba_optional import numba
3
3
  from abc import ABC, abstractmethod
4
4
 
5
5
  class Layer(ABC):
@@ -0,0 +1,26 @@
1
+ # Wrapper to make numba optional, as DLL import errors of the LLVM compiler have been observed on windows.
2
+ # When numba is not avaliable, the convolutional layer is slowed down significantly.
3
+ import warnings
4
+
5
+ try:
6
+ import numba
7
+ NUMBA_AVAILABLE = True
8
+ except ImportError as e:
9
+ warnings.warn(f"Numba import error (not installed?): {e}")
10
+ NUMBA_AVAILABLE = False
11
+ except OSError as e:
12
+ warnings.warn(f"Numba import error (missing DLL?): {e}")
13
+ NUMBA_AVAILABLE = False
14
+
15
+ if not NUMBA_AVAILABLE:
16
+ # create fake numba API with no-op decorators
17
+ class _FakeNumba:
18
+ def njit(self, *args, **kwargs):
19
+ def decorator(func):
20
+ return func # return the original function unchanged
21
+ return decorator
22
+
23
+ def prange(self, x):
24
+ return range(x) # prange → normal range
25
+
26
+ numba = _FakeNumba()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes