junaidmalik09 / fastonn

FastONN - Python based open-source GPU implementation for Operational Neural Networks
GNU General Public License v3.0
22 stars 9 forks source link


FastONN - Python-based open-source GPU implementation for Operational Neural Networks

Installation

Clone the repository and run the following command from inside the directory:

pip install .

Usage

A common workflow using 2D convolutions looks as follows:

torch.nn.Conv2d(in_channels, out_channels, kernel_size)

This can be converted into a Self-ONN simply by swapping the convolutional layer with a Self-ONN layer:

from fastonn import SelfONN2dLayer
SelfONN2dLayer(in_channels, out_channels, kernel_size, q=3)

where q controls the extent of non-linearity. q=1 is equivalent to a CNN

For using super neurons, the additional parameter of max_shift is required

from fastonn import SuperONN2dLayer
SuperONN2dLayer(in_channels, out_channels, kernel_size, max_shift=18, q=3)

Precautions

References