Skip to main content

TorchAct, collection of activation function for PyTorch.

Project description

torchact

TorchAct, collection of activation function for PyTorch.


image CI codecov Read the Docs
image PyPI - Status PyPI - Python Version image Downloads
image PyTorch PyPI - License image

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.

  1. Fork this repo (you can work dev branch.)
  2. Install library using requirements.txt
  3. Write your code in torchact folder.
  4. 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")
  1. 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
  1. Run black style.black .
  2. 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


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.2.tar.gz (8.5 kB view hashes)

Uploaded Source

Built Distribution

torchact-1.1.2-py3-none-any.whl (10.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page