API to compose pytorch neural networks
Project description
torch-composer
Compose pytorch neural networks with ease.
Installation (current version: v0.1.0
)
pip install torch-composer
Sample use-cases of the API
import torch_composer
import torch
net = torch_composer.TorchNet(in_dim=2500, out_dim=10)
Sequential(
(input): Linear(in_features=2500, out_features=200, bias=True)
(activation_1): LeakyReLU(negative_slope=0.01)
(hidden_1): Linear(in_features=200, out_features=200, bias=True)
(output_activation): LeakyReLU(negative_slope=0.01)
(output): Linear(in_features=200, out_features=10, bias=True)
)
As simple as you want (see above) or more complex with optional parameters:
torch_composer.TorchNet(
in_dim=2500,
out_dim=10,
hidden={1: [800, 800], 2: [200, 200]},
activation_function=torch.nn.LeakyReLU(negative_slope=0.01),
dropout=0.2,
input_bias=True,
output_bias=True,
)
Sequential(
(input): Linear(in_features=2500, out_features=800, bias=True)
(activation_1): LeakyReLU(negative_slope=0.01)
(hidden_1): Linear(in_features=800, out_features=800, bias=True)
(dropout_1): Dropout(p=0.2, inplace=False)
(activation_2): LeakyReLU(negative_slope=0.01)
(hidden_2): Linear(in_features=200, out_features=200, bias=True)
(dropout_2): Dropout(p=0.2, inplace=False)
(output_activation): LeakyReLU(negative_slope=0.01)
(output): Linear(in_features=200, out_features=10, bias=True)
)
Make an encoder
torch_composer.TorchNetDecoder(data_dim=2500, latent_dim=10)
Make a decoder
torch_composer.TorchNetDecoder(data_dim=2500, latent_dim=10)
Access and set initial parameters for the output layer:
torch_composer.tools.init_output_params(net)
Potential future plans
- Composition of
torch.optim
funcs.
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
Built Distribution
Close
Hashes for torch_composer-0.0.4rc0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b1c0586c2c5d0e8a9f23c21aa4dd9f3e801dcf5b651f8d33e4a84637c1c9bd1 |
|
MD5 | d7750f5bd3a7b5a69f59c52b9bcaf425 |
|
BLAKE2b-256 | d4d04db5f861ceb5674b25a2b300709599ecdcae5da8f34a78aaadd064865abc |