A library of new activation function implement in PyTorch to save time in experiment and have fun
Project description
PyTorch Activations
PyTorch Activations is a collection of activation functions for the PyTorch library. This project aims to provide an easy-to-use solution for experimenting with different activation functions or simply adding variety to your models.
Installation
You can install PyTorch Activations using pip:
$ pip install torch-activation
Usage
To use the activation functions, import them from torch_activation. Here's an example:
import torch_activation as tac
m = tac.ShiLU(inplace=True)
x = torch.rand(16, 3, 384, 384)
m(x)
Or in nn.Sequential
:
import torch
import torch.nn as nn
import torch_activation as tac
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.net = nn.Sequential(
nn.Conv2d(64, 32, 2),
tac.DELU(),
nn.ConvTranspose2d(32, 64, 2),
tac.ReLU(inplace=True),
)
def forward(self, x):
return self.net(x)
Activation functions can be imported directly from the package, such as torch_activation.CoLU
, or from submodules, such as torch_activation.non_linear.CoLU
.
For a comprehensive list of available functions, please refer to the LIST_OF_FUNCTION file.
To learn more about usage, please refer to Documentation
We hope you find PyTorch Activations useful for your experimentation and model development. Enjoy exploring different activation functions!
Contact
Alan Huynh - LinkedIn - hdmquan@outlook.com
Project Link: https://github.com/alan191006/torch_activation
Documentation Link: https://torch-activation.readthedocs.io
PyPI Link: https://pypi.org/project/torch-activation/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file torch_activation-0.2.1.tar.gz
.
File metadata
- Download URL: torch_activation-0.2.1.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.9.13 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 144dc45aed72637aef5582c457611500beef12c26c78a484d30af5f99a2df803 |
|
MD5 | 07c87c6b57e7b7181a186752ee409e43 |
|
BLAKE2b-256 | 1eb21b10d04597eb80c0a09c1d007741ba23508ced0368bc1de9a5eff90465cc |
File details
Details for the file torch_activation-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: torch_activation-0.2.1-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.9.13 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1c29f77069dc3fd3741e90c0775c222bb44934b7f3c7365b5b67a6384bb5196 |
|
MD5 | f8075139a91f2ca6407f4216dd3f8308 |
|
BLAKE2b-256 | d2b68cad48fd7ac5c11df41c516a730782da82c3364f94d4a4f7cd02d74928ab |