File size: 2,453 Bytes
8a97c08 717576e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
---
license: cc-by-nc-sa-4.0
library_name: pytorch
tags:
- activation-function
- activation_function
- dynamic_activation_function
- dynamic-activation-function
---
# Universal Activation Function
Tensorflow and Pytorch source code for the paper
[Yuen, Brosnan, Minh Tu Hoang, Xiaodai Dong, and Tao Lu. "Universal activation function for machine learning." Scientific reports 11, no. 1 (2021): 1-11.](https://www.nature.com/articles/s41598-021-96723-8)
# Getting the code
Requires [Docker](https://docs.docker.com/get-docker/)
Use git to pull this repo
```
git clone https://github.com/SensorOrgNet/Universal_Activation_Function.git
```
# Running the Tensorflow 2 version
Install CUDA 11.2 container
```
docker run --name UAF --gpus all -v /home/username/UAF/:/workspace -w /workspace -it nvcr.io/nvidia/cuda:11.2.0-cudnn8-devel-ubuntu20.04 bash
```
Install python
```
apt update
apt install python3-pip
```
Install pytorch and pytorch geometric
```
pip3 install tensorflow==2.7.0
```
Run the MLP with UAF for MNIST dataset
```
cd Universal_Activation_Function/tensorflow/
python3 ./mnist_UAF.py
```
# Running the Pytorch version
Install CUDA 11.3 container
```
docker run --name UAF --gpus all -v /home/username/UAF/:/workspace -w /workspace -it nvcr.io/nvidia/cuda:11.3.0-cudnn8-devel-ubuntu20.04 bash
```
Install python
```
apt update
apt install python3-pip
```
Install pytorch and pytorch geometric
```
pip3 install torch==1.10.0+cu113 torchvision==0.11.1+cu113 torchaudio==0.10.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
pip3 install torch-scatter -f https://data.pyg.org/whl/torch-1.10.0+cu113.html
pip3 install torch-sparse -f https://data.pyg.org/whl/torch-1.10.0+cu113.html
pip3 install torch-cluster -f https://data.pyg.org/whl/torch-1.10.0+cu113.html
pip3 install torch-spline-conv -f https://data.pyg.org/whl/torch-1.10.0+cu113.html
pip3 install torch-geometric
```
Run the CNN with UAF for MNIST dataset
```
cd Universal_Activation_Function/pytorch/
python3 ./mnist_UAF.py
```
Run the GCN2 with UAF for CORA dataset. The fold number is represented by the number at the end
```
cd Universal_Activation_Function/pytorch/
python3 ./gcn2_cora_UAF.py 0
```
Run the PNA with UAF for ZNC dataset. The fold number is represented by the number at the end
```
cd Universal_Activation_Function/pytorch/
python3 ./pna_UAF.py 0
```
|