Skip to main content

coregeist is a Python library to convert deep neural network models into c source code.

Project description

bitgeist

bitgeist is a Python library to convert deep neural network models into c source code.

Installation

Use the package manager pip to install bitgeist.

pip install coregeist

Usage

import coregeist as cg

# transform a pytorch model to c code
print(cg.transform(model))

Example:

    ...

import coregeist as cg

...


class MnistModel(nn.Module):

    def __init__(self):
        super(MnistModel, self).__init__()

        inputs = 28 * 28
        hidden = 120
        output = 10

        self.l1 = cg.Linear(inputs, hidden, downsample=downsample)
        self.action = nn.PReLU(hidden)
        self.l2 = cg.Linear(hidden, output, downsample=downsample)

    def forward(self, x):
        out = self.l1(x)
        out = self.action(out)
        out = self.l2(out)
        return out


model = MnistModel().to(device)

# train the model 

...

print(cg.transform(model))  # print or write to file ...
...

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coregeist-0.1.5.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

coregeist-0.1.5-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file coregeist-0.1.5.tar.gz.

File metadata

  • Download URL: coregeist-0.1.5.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0a2 CPython/3.9.7 Darwin/21.3.0

File hashes

Hashes for coregeist-0.1.5.tar.gz
Algorithm Hash digest
SHA256 ba08c357c7a46e2c19ce6521b9477803f188c393ce088ce513c6ed546494959f
MD5 4dc222907dfd16aa417f6c5f839dfacb
BLAKE2b-256 691e77c1d581f979a931f54ac64958a4954a3698ae11e30007ff099640670925

See more details on using hashes here.

File details

Details for the file coregeist-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: coregeist-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0a2 CPython/3.9.7 Darwin/21.3.0

File hashes

Hashes for coregeist-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 086ae7441d959cd2ac97200390ed584e135ee622687fec613c74bfd96e785431
MD5 33a0e0771610ca93693909b107fb671f
BLAKE2b-256 4f80734f478bdc6da4eb1442d4b475d79fe94d07809a8bdba21f45deb586008e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page