Skip to content

mvinyard/torch-nets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

PyPI pyversions PyPI version Code style: black

Compose PyTorch neural networks with ease.

Installation

From PYPI (current version: v0.0.5)

pip install torch-nets

Alternatively, install the development version from GitHub:

git clone https://github.com/mvinyard/torch-nets.git;
cd torch-nets; pip install -e .

Example API use-cases

from torch_nets import TorchNet

Create a feed-forward neural network

The only required arguments are in_features and out_features. The network can be made as simple or complex as you want through optional parameters.

net = TorchNet(
    in_features=50,
    out_features=50,
    hidden=[400, 400],
    activation="LeakyReLU",
    dropout=0.2,
    bias=True,
    output_bias=True,
)
See output
TorchNet(
  (hidden_1): Sequential(
    (linear): Linear(in_features=50, out_features=400, bias=True)
    (dropout): Dropout(p=0.2, inplace=False)
    (activation): LeakyReLU(negative_slope=0.01)
  )
  (hidden_2): Sequential(
    (linear): Linear(in_features=400, out_features=400, bias=True)
    (dropout): Dropout(p=0.2, inplace=False)
    (activation): LeakyReLU(negative_slope=0.01)
  )
  (output): Sequential(
    (linear): Linear(in_features=400, out_features=50, bias=True)
  )
)

Documentation

For more information, including examples of additional use-cases please visit the documentation (coming soon)! Additional use-cases include: Encoder, Decoder, AugmentedTorchNet.

Potential future plans

  • Flexible composition of torch.optim funcs.
  • Potential pytorch_lightning use-cases.

Problem? Open an issue or get in touch via email.