loglu-pytorch 1.0.0__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.
- loglu_pytorch-1.0.0/PKG-INFO +93 -0
- loglu_pytorch-1.0.0/README.md +75 -0
- loglu_pytorch-1.0.0/loglu_pytorch/__init__.py +1 -0
- loglu_pytorch-1.0.0/loglu_pytorch/loglu_pytorch.py +28 -0
- loglu_pytorch-1.0.0/loglu_pytorch.egg-info/PKG-INFO +93 -0
- loglu_pytorch-1.0.0/loglu_pytorch.egg-info/SOURCES.txt +9 -0
- loglu_pytorch-1.0.0/loglu_pytorch.egg-info/dependency_links.txt +1 -0
- loglu_pytorch-1.0.0/loglu_pytorch.egg-info/requires.txt +1 -0
- loglu_pytorch-1.0.0/loglu_pytorch.egg-info/top_level.txt +1 -0
- loglu_pytorch-1.0.0/setup.cfg +4 -0
- loglu_pytorch-1.0.0/setup.py +27 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: loglu-pytorch
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: ZenGrad: A gradient descent method focused on stability, smooth updates, and efficient, adaptive learning.
|
|
5
|
+
Home-page: https://github.com/Poorni-Murumuri/loglu-pytorch
|
|
6
|
+
Author: Murumuri Naga Poorni
|
|
7
|
+
Author-email: poorni.m0405@gmail.com
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Requires-Python: >=3.6
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: torch>=1.6.0
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## LogLU (Logarithmic Linear Units) — Activation Function
|
|
21
|
+
|
|
22
|
+
Welcome to **LogLU**, a novel activation function designed to enhance the performance of deep neural networks.
|
|
23
|
+
|
|
24
|
+
The **Logarithmic Linear Unit (LogLU)** improves convergence speed, stability, and overall model performance. Whether you're working on AI for image recognition, NLP, or other applications, this activation function is designed to make your models more efficient.
|
|
25
|
+
|
|
26
|
+
### Why LogLU?
|
|
27
|
+
|
|
28
|
+
Activation functions like ReLU are commonly used, but sometimes a more refined and efficient solution is required. Here’s why LogLU stands out:
|
|
29
|
+
|
|
30
|
+
- **Faster Convergence**: LogLU helps your models train more quickly, saving time and computational resources.
|
|
31
|
+
- **Stability**: It prevents issues like exploding or vanishing gradients, ensuring smooth training.
|
|
32
|
+
- **Performance**: LogLU consistently improves accuracy and reduces loss compared to traditional activation functions.
|
|
33
|
+
|
|
34
|
+
### Installation
|
|
35
|
+
|
|
36
|
+
To use LogLU, simply install it using the following command:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install loglu-pytorch
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Usage
|
|
43
|
+
|
|
44
|
+
Here’s how to integrate LogLU into your deep learning models.
|
|
45
|
+
|
|
46
|
+
#### With Pytorch:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
import torch
|
|
50
|
+
from loglu_pytorch import LogLU
|
|
51
|
+
|
|
52
|
+
# Define the model
|
|
53
|
+
class MyModel(nn.Module):
|
|
54
|
+
def __init__(self):
|
|
55
|
+
super(MyModel, self).__init__()
|
|
56
|
+
self.fc1 = nn.Linear(784, 128)
|
|
57
|
+
self.loglu = LogLU()
|
|
58
|
+
self.fc2 = nn.Linear(128, 10)
|
|
59
|
+
|
|
60
|
+
def forward(self, x):
|
|
61
|
+
x = self.fc1(x)
|
|
62
|
+
x = self.loglu(x)
|
|
63
|
+
x = self.fc2(x)
|
|
64
|
+
return F.softmax(x, dim=1) # Equivalent to 'softmax' activation in final layer
|
|
65
|
+
|
|
66
|
+
# Instantiate the model
|
|
67
|
+
model = MyModel()
|
|
68
|
+
|
|
69
|
+
# Print the model summary (you can use torchsummary for a detailed view)
|
|
70
|
+
from torchsummary import summary
|
|
71
|
+
summary(model, input_size=(1, 784))
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### How It Works
|
|
76
|
+
|
|
77
|
+
LogLU combines the smooth characteristics of logarithmic functions with the simplicity of linear functions like ReLU. It maintains gradient flow even in deep networks, ensuring fast and stable learning without the typical issues of gradient vanishing or exploding.
|
|
78
|
+
|
|
79
|
+
For those interested in the mathematical details:
|
|
80
|
+
- If `x > 0`: LogLU behaves as a linear function.
|
|
81
|
+
- If `x <= 0`: It adopts a logarithmic form, providing a smoother handling of negative values.
|
|
82
|
+
|
|
83
|
+
## Feedback & Contributions
|
|
84
|
+
|
|
85
|
+
If you have feedback or would like to contribute, please feel free to open an issue or contribute on GitHub.
|
|
86
|
+
|
|
87
|
+
Contact: Email: poorni.m0405@gmail.com, rishichaitanya888@gmail.com
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
LogLU_Pytorch is released under the [Apache License 2.0](https://github.com/Poorni-Murumuri/loglu-pytorch/blob/main/LICENSE).
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
|
|
2
|
+
## LogLU (Logarithmic Linear Units) — Activation Function
|
|
3
|
+
|
|
4
|
+
Welcome to **LogLU**, a novel activation function designed to enhance the performance of deep neural networks.
|
|
5
|
+
|
|
6
|
+
The **Logarithmic Linear Unit (LogLU)** improves convergence speed, stability, and overall model performance. Whether you're working on AI for image recognition, NLP, or other applications, this activation function is designed to make your models more efficient.
|
|
7
|
+
|
|
8
|
+
### Why LogLU?
|
|
9
|
+
|
|
10
|
+
Activation functions like ReLU are commonly used, but sometimes a more refined and efficient solution is required. Here’s why LogLU stands out:
|
|
11
|
+
|
|
12
|
+
- **Faster Convergence**: LogLU helps your models train more quickly, saving time and computational resources.
|
|
13
|
+
- **Stability**: It prevents issues like exploding or vanishing gradients, ensuring smooth training.
|
|
14
|
+
- **Performance**: LogLU consistently improves accuracy and reduces loss compared to traditional activation functions.
|
|
15
|
+
|
|
16
|
+
### Installation
|
|
17
|
+
|
|
18
|
+
To use LogLU, simply install it using the following command:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install loglu-pytorch
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Usage
|
|
25
|
+
|
|
26
|
+
Here’s how to integrate LogLU into your deep learning models.
|
|
27
|
+
|
|
28
|
+
#### With Pytorch:
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
import torch
|
|
32
|
+
from loglu_pytorch import LogLU
|
|
33
|
+
|
|
34
|
+
# Define the model
|
|
35
|
+
class MyModel(nn.Module):
|
|
36
|
+
def __init__(self):
|
|
37
|
+
super(MyModel, self).__init__()
|
|
38
|
+
self.fc1 = nn.Linear(784, 128)
|
|
39
|
+
self.loglu = LogLU()
|
|
40
|
+
self.fc2 = nn.Linear(128, 10)
|
|
41
|
+
|
|
42
|
+
def forward(self, x):
|
|
43
|
+
x = self.fc1(x)
|
|
44
|
+
x = self.loglu(x)
|
|
45
|
+
x = self.fc2(x)
|
|
46
|
+
return F.softmax(x, dim=1) # Equivalent to 'softmax' activation in final layer
|
|
47
|
+
|
|
48
|
+
# Instantiate the model
|
|
49
|
+
model = MyModel()
|
|
50
|
+
|
|
51
|
+
# Print the model summary (you can use torchsummary for a detailed view)
|
|
52
|
+
from torchsummary import summary
|
|
53
|
+
summary(model, input_size=(1, 784))
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### How It Works
|
|
58
|
+
|
|
59
|
+
LogLU combines the smooth characteristics of logarithmic functions with the simplicity of linear functions like ReLU. It maintains gradient flow even in deep networks, ensuring fast and stable learning without the typical issues of gradient vanishing or exploding.
|
|
60
|
+
|
|
61
|
+
For those interested in the mathematical details:
|
|
62
|
+
- If `x > 0`: LogLU behaves as a linear function.
|
|
63
|
+
- If `x <= 0`: It adopts a logarithmic form, providing a smoother handling of negative values.
|
|
64
|
+
|
|
65
|
+
## Feedback & Contributions
|
|
66
|
+
|
|
67
|
+
If you have feedback or would like to contribute, please feel free to open an issue or contribute on GitHub.
|
|
68
|
+
|
|
69
|
+
Contact: Email: poorni.m0405@gmail.com, rishichaitanya888@gmail.com
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
LogLU_Pytorch is released under the [Apache License 2.0](https://github.com/Poorni-Murumuri/loglu-pytorch/blob/main/LICENSE).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .loglu_pytorch import LogLU
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import torch
|
|
2
|
+
import torch.nn as nn
|
|
3
|
+
from torch.autograd import Function
|
|
4
|
+
|
|
5
|
+
class LogLUFunction(Function):
|
|
6
|
+
@staticmethod
|
|
7
|
+
def forward(ctx, input):
|
|
8
|
+
epsilon = 1e-7
|
|
9
|
+
ctx.save_for_backward(input)
|
|
10
|
+
# We clip input to avoid log(0) for x = 1
|
|
11
|
+
input_clipped = torch.clamp(input, max=1.0 - 1e-7)
|
|
12
|
+
output = torch.where(input > 0, input, -torch.log(1 - input_clipped) + epsilon)
|
|
13
|
+
return output
|
|
14
|
+
|
|
15
|
+
@staticmethod
|
|
16
|
+
def backward(ctx, grad_output):
|
|
17
|
+
(input,) = ctx.saved_tensors
|
|
18
|
+
# Avoid division by zero
|
|
19
|
+
input_clipped = torch.clamp(input, max=1.0 - 1e-7)
|
|
20
|
+
grad_input = torch.where(input > 0, torch.ones_like(input), 1.0 / (1.0 - input_clipped))
|
|
21
|
+
return grad_output * grad_input
|
|
22
|
+
|
|
23
|
+
class LogLU(nn.Module):
|
|
24
|
+
def __init__(self):
|
|
25
|
+
super(LogLU, self).__init__()
|
|
26
|
+
|
|
27
|
+
def forward(self, input):
|
|
28
|
+
return LogLUFunction.apply(input)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: loglu-pytorch
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: ZenGrad: A gradient descent method focused on stability, smooth updates, and efficient, adaptive learning.
|
|
5
|
+
Home-page: https://github.com/Poorni-Murumuri/loglu-pytorch
|
|
6
|
+
Author: Murumuri Naga Poorni
|
|
7
|
+
Author-email: poorni.m0405@gmail.com
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Requires-Python: >=3.6
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: torch>=1.6.0
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## LogLU (Logarithmic Linear Units) — Activation Function
|
|
21
|
+
|
|
22
|
+
Welcome to **LogLU**, a novel activation function designed to enhance the performance of deep neural networks.
|
|
23
|
+
|
|
24
|
+
The **Logarithmic Linear Unit (LogLU)** improves convergence speed, stability, and overall model performance. Whether you're working on AI for image recognition, NLP, or other applications, this activation function is designed to make your models more efficient.
|
|
25
|
+
|
|
26
|
+
### Why LogLU?
|
|
27
|
+
|
|
28
|
+
Activation functions like ReLU are commonly used, but sometimes a more refined and efficient solution is required. Here’s why LogLU stands out:
|
|
29
|
+
|
|
30
|
+
- **Faster Convergence**: LogLU helps your models train more quickly, saving time and computational resources.
|
|
31
|
+
- **Stability**: It prevents issues like exploding or vanishing gradients, ensuring smooth training.
|
|
32
|
+
- **Performance**: LogLU consistently improves accuracy and reduces loss compared to traditional activation functions.
|
|
33
|
+
|
|
34
|
+
### Installation
|
|
35
|
+
|
|
36
|
+
To use LogLU, simply install it using the following command:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install loglu-pytorch
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Usage
|
|
43
|
+
|
|
44
|
+
Here’s how to integrate LogLU into your deep learning models.
|
|
45
|
+
|
|
46
|
+
#### With Pytorch:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
import torch
|
|
50
|
+
from loglu_pytorch import LogLU
|
|
51
|
+
|
|
52
|
+
# Define the model
|
|
53
|
+
class MyModel(nn.Module):
|
|
54
|
+
def __init__(self):
|
|
55
|
+
super(MyModel, self).__init__()
|
|
56
|
+
self.fc1 = nn.Linear(784, 128)
|
|
57
|
+
self.loglu = LogLU()
|
|
58
|
+
self.fc2 = nn.Linear(128, 10)
|
|
59
|
+
|
|
60
|
+
def forward(self, x):
|
|
61
|
+
x = self.fc1(x)
|
|
62
|
+
x = self.loglu(x)
|
|
63
|
+
x = self.fc2(x)
|
|
64
|
+
return F.softmax(x, dim=1) # Equivalent to 'softmax' activation in final layer
|
|
65
|
+
|
|
66
|
+
# Instantiate the model
|
|
67
|
+
model = MyModel()
|
|
68
|
+
|
|
69
|
+
# Print the model summary (you can use torchsummary for a detailed view)
|
|
70
|
+
from torchsummary import summary
|
|
71
|
+
summary(model, input_size=(1, 784))
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### How It Works
|
|
76
|
+
|
|
77
|
+
LogLU combines the smooth characteristics of logarithmic functions with the simplicity of linear functions like ReLU. It maintains gradient flow even in deep networks, ensuring fast and stable learning without the typical issues of gradient vanishing or exploding.
|
|
78
|
+
|
|
79
|
+
For those interested in the mathematical details:
|
|
80
|
+
- If `x > 0`: LogLU behaves as a linear function.
|
|
81
|
+
- If `x <= 0`: It adopts a logarithmic form, providing a smoother handling of negative values.
|
|
82
|
+
|
|
83
|
+
## Feedback & Contributions
|
|
84
|
+
|
|
85
|
+
If you have feedback or would like to contribute, please feel free to open an issue or contribute on GitHub.
|
|
86
|
+
|
|
87
|
+
Contact: Email: poorni.m0405@gmail.com, rishichaitanya888@gmail.com
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
LogLU_Pytorch is released under the [Apache License 2.0](https://github.com/Poorni-Murumuri/loglu-pytorch/blob/main/LICENSE).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
setup.py
|
|
3
|
+
loglu_pytorch/__init__.py
|
|
4
|
+
loglu_pytorch/loglu_pytorch.py
|
|
5
|
+
loglu_pytorch.egg-info/PKG-INFO
|
|
6
|
+
loglu_pytorch.egg-info/SOURCES.txt
|
|
7
|
+
loglu_pytorch.egg-info/dependency_links.txt
|
|
8
|
+
loglu_pytorch.egg-info/requires.txt
|
|
9
|
+
loglu_pytorch.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
torch>=1.6.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
loglu_pytorch
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
from setuptools import setup, find_packages
|
|
3
|
+
|
|
4
|
+
setup(
|
|
5
|
+
name='loglu-pytorch',
|
|
6
|
+
version='1.0.0',
|
|
7
|
+
description='ZenGrad: A gradient descent method focused on stability, smooth updates, and efficient, adaptive learning.',
|
|
8
|
+
long_description=open('README.md', encoding='utf-8').read(),
|
|
9
|
+
long_description_content_type='text/markdown',
|
|
10
|
+
author= 'Murumuri Naga Poorni ',
|
|
11
|
+
author_email='poorni.m0405@gmail.com',
|
|
12
|
+
packages=find_packages(),
|
|
13
|
+
url='https://github.com/Poorni-Murumuri/loglu-pytorch',
|
|
14
|
+
license="Apache-2.0",
|
|
15
|
+
install_requires=[
|
|
16
|
+
"torch>=1.6.0"
|
|
17
|
+
],
|
|
18
|
+
classifiers=[
|
|
19
|
+
'Programming Language :: Python :: 3',
|
|
20
|
+
"License :: OSI Approved :: Apache Software License",
|
|
21
|
+
'Operating System :: OS Independent',
|
|
22
|
+
'Intended Audience :: Developers',
|
|
23
|
+
'Intended Audience :: Science/Research',
|
|
24
|
+
'Topic :: Scientific/Engineering :: Artificial Intelligence',
|
|
25
|
+
],
|
|
26
|
+
python_requires='>=3.6',
|
|
27
|
+
)
|