xml2pytorch
Using xml to define pytorch neural networks
What can it Do
With xml2pytorch, you can easily define neural networks in xml, and then declare them in pytorch.
RNN and LSTM are not supported currently.
Installation
Environment
OS independent. Python3. (Not tested on Python2, but it should work.)
Install requirements
torch>=0.4.1 numpy>=1.15.1
Installing by pip3
pip3 install xml2pytorch
Quick Start
How to declare the CNN defined by a xml file
import torch
import xml2pytorch as xm
# declare the net defined in .xml
net = xm.convertXML(xml_filename)
# input a random tensor
x = torch.randn(1, 3, 32, 32)
y = net(x)
print(y)
How to define a simple CNN in xml
<graph>
<net>
<layer>
<net_style>Conv2d</net_style>
<in_channels>3</in_channels>
<out_channels>6</out_channels>
<kernel_size>5</kernel_size>
</layer>
<layer>
<net_style>ELU</net_style>
</layer>
<layer>
<net_style>MaxPool2d</net_style>
<kernel_size>2</kernel_size>
<stride>2</stride>
<activation>logsigmoid</activation>
</layer>
<layer>
<net_style>Conv2d</net_style>
<in_channels>6</in_channels>
<out_channels>16</out_channels>
<kernel_size>5</kernel_size>
<activation>relu</activation>
</layer>
<layer>
<net_style>MaxPool2d</net_style>
<kernel_size>2</kernel_size>
<stride>2</stride>
<activation>relu</activation>
</layer>
<layer>
<net_style>reshape</net_style>
<dimensions>[-1, 16*5*5]</dimensions>
</layer>
<layer>
<net_style>Linear</net_style>
<in_features>400</in_features>
<out_features>120</out_features>
<activation>tanh</activation>
</layer>
<layer>
<net_style>Linear</net_style>
<in_features>120</in_features>
<out_features>84</out_features>
<activation>sigmoid</activation>
</layer>
<layer>
<net_style>Linear</net_style>
<in_features>84</in_features>
<out_features>10</out_features>
<activation>softmax</activation>
</layer>
</net>
</graph>
Metadata
Release files for xml2pytorch 0.0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xml2pytorch-0.0.10.tar.gz | 6.2 kB | Without provenance | Details for xml2pytorch-0.0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xml2pytorch-0.0.10-py3-none-any.whl | Python 3 | none | any | Details for xml2pytorch-0.0.10-py3-none-any.whl |
Total release size: 12.7 kB
Release files / xml2pytorch-0.0.10.tar.gz
| Download URL | xml2pytorch-0.0.10.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a1571ce6c88ca2ff5b251ee22853e7c71e80d8ff95b47c4463f490922c7d30f6
|
|
BLAKE2b-256 checksum How to use checksums |
c5eb6657fac128433c3655c8c48c2fede9ca0005afb149f8b4bb74fd41edcb68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.4
|
Release files / xml2pytorch-0.0.10-py3-none-any.whl
| Download URL | xml2pytorch-0.0.10-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
70b997318f35c5770d1fc8857ca5d234730679386e2cc146b4dcd1c6e0aba019
|
|
BLAKE2b-256 checksum How to use checksums |
09a88e4671b7924e3a1dc8f5fa3cc914b5591cd60315b51764f68bedf88d3d30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.4
|
Security for xml2pytorch 0.0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.