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

Uploaded Source

Built Distribution

torchact-1.1.1-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file torchact-1.1.1.tar.gz.

File metadata

  • Download URL: torchact-1.1.1.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

Hashes for torchact-1.1.1.tar.gz
Algorithm Hash digest
SHA256 57d3d07fb2b4856f0301d50646f4964c38978b7f513232f7c919427b74d1f8ed
MD5 f9c2fc34bab2cd41b5851768732b2386
BLAKE2b-256 5efd2a8cce938954e4004cabf9a319edce9827d009bb0dda61a6e455795ff547

See more details on using hashes here.

File details

Details for the file torchact-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: torchact-1.1.1-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

Hashes for torchact-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 849f084e9a8084cfa3aee9582abf8aab3d7b436c2be9774d4031ffdbd1c57d21
MD5 5086c59ca3d1e70ee17d155234abf83a
BLAKE2b-256 ac3d2019e0a6e9b895953871d1c6b85486c6404e8d1cdec5f8a6ef0257ffda6e

See more details on using hashes here.

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