TorchAct, collection of activation function for PyTorch.
Project description
torchact
Quick Start
import torch
import torch.nn as nn
import torchact.nn as actnn
model = nn.Sequential(
nn.Linear(5, 3),
actnn.ReLU(),
nn.Linear(3, 1),
nn.Sigmoid()
)
dummy = torch.rand(1, 5)
print(model(dummy))
Installation
pip install torchact
How to Contribute
Thanks for your contribution!
There are several steps for contributing.
- Fork this repo (you can work dev branch.)
- Install library using
requirements.txt
- Write your code in torchact folder.
- Add your module in
__init__.py
(__version__
cannot be changed. It will be decided later.)
For example.
from .your_module import Your_Module
__all__ = ("ReLU", "SinLU", "Softmax", "Your_Module")
- If you want to test case, Write test case.
For example.
def test_has_attr():
for activation_name in __all__:
if activation_name == "Softmax":
assert hasattr(str_to_class(activation_name)(), "dim")
else:
pass
- Run black style.
black .
- Send a PR. Code testing happens automatically. (PYPI is upgraded by the admin himself.)
Citing TorchAct
To cite this repository:
@article{hantorchact,
title={TorchAct, collection of activation function for PyTorch.},
author={Seungwoo Han},
publisher={Engineering Archive},
doi={10.31224/2988},
url={https://engrxiv.org/preprint/view/2988}
year={2023}
}
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
torchact-1.1.0.tar.gz
(8.5 kB
view details)
Built Distribution
torchact-1.1.0-py3-none-any.whl
(10.1 kB
view details)
File details
Details for the file torchact-1.1.0.tar.gz
.
File metadata
- Download URL: torchact-1.1.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3285b533bb6ec5c0334a1d9918ec8de980252e82d164c26238f13aad6d07e9d |
|
MD5 | b6e7b861b2516910334eb3fa12c42434 |
|
BLAKE2b-256 | 4dd965c1db065836655078cd388f62e7a4abc69e284f3d95ff20167f31df4645 |
File details
Details for the file torchact-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: torchact-1.1.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbcb3f7c86c345cfab71b87093dff09ee14736ccf6eb83ef65761d6c262ba1e7 |
|
MD5 | db71a4d766fd81d2eb0dd6aed737e7db |
|
BLAKE2b-256 | 2e9ecd7811842a75a097267c352ad3a82ac7a5d6184ca3a4419c8fea7fb620d2 |