Provides functional API for model creation in PyTorch.
Project description
Pytorch Functional
Pytorch Functional is a MIT licensed library that adds functional API for model creation to PyTorch.
Defining complex models in PyTorch requires creating classes. Defining models in tensorflow is easier. This makes it just as easy in PyTorch.
Features:
- Small extension to PyTorch
- No dependencies besides PyTorch
- Produces models entirely compatible with PyTorch
- Reduces the amount of code that you need to write
- Works well with complex architectures
- Adds no overhead
Example
>>> from torch import nn
>>> from pytorch_functional import Input, FunctionalModel
>>> inputs = Input(shape=(1, 28, 28))
>>> x = inputs(nn.Flatten())(nn.ReLU())
>>> outputs = x(nn.Linear(x.shape[1], 10))
>>> model = FunctionalModel(inputs, outputs)
>>> model
FunctionalModel(
(module000_depth001): Flatten(start_dim=1, end_dim=-1)
(module001_depth002): ReLU()
(module002_depth003): Linear(in_features=784, out_features=10, bias=True)
)
See more examples in Quick Start.
Installation
Install easily with pip:
pip install pytorch-functional
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytorch-functional-0.2.13.tar.gz
(10.2 kB
view hashes)
Close
Hashes for pytorch-functional-0.2.13.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce80ed1fbd92d3e5230a8814465bf5bad6b0b8014f70254674736dbb0a34c9e2 |
|
MD5 | bb9db15fc124cddb17745f1ebd157a7c |
|
BLAKE2b-256 | 0e97510215894b4716385740e35180027dc3798b9ad3e3d26cde93e907e09a59 |