Skip to main content

Rational Activations

Project description

Logo

Rational Activations - Learnable Rational Activation Functions

First introduce as PAU in Padé Activation Units: End-to-end Learning of Activation Functions in Deep Neural Network.

1. About Rational Activation Functions

Rational Activations are a novel learnable activation functions. Rationals encode activation functions as rational functions, trainable in an end-to-end fashion using backpropagation and can be seemingless integrated into any neural network in the same way as common activation functions (e.g. ReLU).

Rationals: Beyond known Activation Functions

Rational can approximate any known activation function arbitrarily well (cf. Padé Activation Units: End-to-end Learning of Flexible Activation Functions in Deep Networks): rational_approx (*the dashed lines represent the rational approximation of every function)

Rational are made to be optimized by the gradient descent, and can discover good properties of activation functions after learning (cf Recurrent Rational Networks): rational_properties

Rationals evaluation on different tasks

Rational matches or outperforms common activations in terms of predictive performance and training time. And, therefore relieves the network designer of having to commit to a potentially underperforming choice.

  • Recurrent Rational Functions have then been introduced in Recurrent Rational Networks, and both Rational and Recurrent Rational Networks are evaluated on RL Tasks. rl_scores :octocat: See rational_rl github repo

2. Dependencies

PyTorch>=1.4.0
CUDA>=10.1

3. Installation

To install the rational_activations module, you can use pip, but:

:bangbang: You should be careful about the CUDA version running on your machine.

To get your CUDA version:

import torch
torch.version.cuda

For your corresponding version of CUDA, please use one of the following command blocks:

CUDA 10.2

 pip3 install -U pip wheel
 pip3 install torch rational-activations

CUDA 10.1

Python3.6
   pip3 install -U pip wheel
   pip3 install torch==1.7.1+cu101
   pip3 install https://iron.aiml.informatik.tu-darmstadt.de/wheelhouse/cuda-10.1/rational_activations-0.0.19-cp36-cp36m-manylinux2014_x86_64.whl
Python3.7
   pip3 install -U pip wheel
   pip3 install torch==1.7.1+cu101
   pip3 install https://iron.aiml.informatik.tu-darmstadt.de/wheelhouse/cuda-10.1/rational_activations-0.0.19-cp37-cp37m-manylinux2014_x86_64.whl
Python3.8
     pip3 install -U pip wheel
     pip3 install torch==1.7.1+cu101
     pip3 install https://iron.aiml.informatik.tu-darmstadt.de/wheelhouse/cuda-10.1/rational_activations-0.0.19-cp38-cp38-manylinux2014_x86_64.whl

Other CUDA/Pytorch

For any other combinaison of python, please install from source:

 pip3 install airspeed
 git clone https://github.com/ml-research/rational_activations.git
 cd rational_activations
 python3 setup.py install --user

If you encounter any trouble installing rational, please contact this person.

4. Using Rational in Neural Networks

Rational can be integrated in the same way as any other common activation function.

import torch
from rational_torch import Rational

model = torch.nn.Sequential(
    torch.nn.Linear(D_in, H),
    Rational(), # e.g. instead of torch.nn.ReLU()
    torch.nn.Linear(H, D_out),
)

5. To be implemented

  • Make a documentation
  • Create tutorial in the doc
  • Tensorflow working version
  • Automatically find initial approx weights for function list
  • Repair + enhance Automatic manylinux production script.
  • Add python3.9 support
  • Make an CUDA 11.0 compatible version
  • Repair the tox test and have them checking before commit

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

File details

Details for the file rational_activations-0.1.0-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rational_activations-0.1.0-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3036a8f5c633a961f6719e8e21e7a64b137c1579123e3036dacd9fd83a541d3c
MD5 30c916e5c0bfd324a080120939c1e279
BLAKE2b-256 e295e4f21c0afd79f84758fc48f6c387513bb134ddecd09ac930da12dd8b9f85

See more details on using hashes here.

File details

Details for the file rational_activations-0.1.0-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rational_activations-0.1.0-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d33735199f2f0fb6c999d70a1b251caeb60d62d71a9f434f3f0efa79701d0607
MD5 ccb6796b9f8fdf6cbe75706b20df297f
BLAKE2b-256 7606aa2c451f843b02996b272b22d879a016369a73c889184a54fab9db412076

See more details on using hashes here.

File details

Details for the file rational_activations-0.1.0-cp36-cp36m-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rational_activations-0.1.0-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 948675cc7379c52943f11e6969451442df284ed3d0a039fe6448de1ce61a51de
MD5 c19ca7859932b5017f35b79280df84be
BLAKE2b-256 c063ab66c664e3c09dc09e0afdd7520f9b531ddf8a1146aaef1fe1a94a2cebb8

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