C code generation program for uTensor
Project description
# Installation (Python 2 & 3)
- installation with `setup.py`
for users:
```
python setup.py install
```
for developers:
```
python setup.py develop
```
- installation with `pip`
```
pip install utensor_cgen
```
# Develop Environment
We use `pipenv` to setup the develop environment.
You can go to this [repo](https://github.com/pypa/pipenv) for detail information about `pipenv`.
## Setup with `pipenv`
1. `$ pipenv install -d`
2. `$ pipenv shell`
- this will spawn a subshell and activate the virtual environment for you
- You should be able to use the cli now
**Note**: If you have trouble with installation with `pipenv`, try to remove `Pipfile.lock` first and run `pipenv install -d` again.
# Example
Please refer to [tests/deep_mlp](https://github.com/uTensor/utensor_cgen/tree/develop/tests/deep_mlp) for detailed example
# User Guide
Following steps are a general guild for user how to porting a `TensorFlow` protobuf file into a `uTensor` implementation:
1. install `utensor_cgent`
- run `python3 setupt.py install`
2. run `utensor-cli graph.pb --output-nodes=NODE,NODE,...`
- run `utensor-cli -h` for help
- the `graph.pb` is the pb file of *original* graph (not quantized)
# How to test (for Developer)
1. follow the steps in [setup](#setup-with-pipenv) section
2. run `make tests`
- Or you can use `pipenv run pytest tests` instead
# Known Limitations
- If you want to use dropout with placeholders for the `keep_prob`, you have to name the `keep_prob` placeholder by any name that starts with "keep_prob".
- You can still use any input tensor with name starts with "keep_prob" as long as it's not the output tensor of a placeholder node.
- You can't wrap `dropout` in any `namescope`
# TODOs
1. (done) Freezed graph protobuff parser
2. (done)Tensor snippets for [`uTensor`](https://github.com/neil-tan/uTensor)
3. (done) Add template engine for richer flexibility
- [jinja2](http://jinja.pocoo.org)
4. (done?) core code generator implementation
- We need some refactoring, PRs are welcomed!
5. type alias in C/C++
- ex: use `uint8_t` or `unsigned char`?
- a lot more about this....
6. (done) `MANIFAST.in` for the `setup.py`
7. Relation among snippets/containers
- shared template variables? (headers, shared placeholders...etc)
8. Better configuration schema
- json
- yaml
- or ?
- installation with `setup.py`
for users:
```
python setup.py install
```
for developers:
```
python setup.py develop
```
- installation with `pip`
```
pip install utensor_cgen
```
# Develop Environment
We use `pipenv` to setup the develop environment.
You can go to this [repo](https://github.com/pypa/pipenv) for detail information about `pipenv`.
## Setup with `pipenv`
1. `$ pipenv install -d`
2. `$ pipenv shell`
- this will spawn a subshell and activate the virtual environment for you
- You should be able to use the cli now
**Note**: If you have trouble with installation with `pipenv`, try to remove `Pipfile.lock` first and run `pipenv install -d` again.
# Example
Please refer to [tests/deep_mlp](https://github.com/uTensor/utensor_cgen/tree/develop/tests/deep_mlp) for detailed example
# User Guide
Following steps are a general guild for user how to porting a `TensorFlow` protobuf file into a `uTensor` implementation:
1. install `utensor_cgent`
- run `python3 setupt.py install`
2. run `utensor-cli graph.pb --output-nodes=NODE,NODE,...`
- run `utensor-cli -h` for help
- the `graph.pb` is the pb file of *original* graph (not quantized)
# How to test (for Developer)
1. follow the steps in [setup](#setup-with-pipenv) section
2. run `make tests`
- Or you can use `pipenv run pytest tests` instead
# Known Limitations
- If you want to use dropout with placeholders for the `keep_prob`, you have to name the `keep_prob` placeholder by any name that starts with "keep_prob".
- You can still use any input tensor with name starts with "keep_prob" as long as it's not the output tensor of a placeholder node.
- You can't wrap `dropout` in any `namescope`
# TODOs
1. (done) Freezed graph protobuff parser
2. (done)Tensor snippets for [`uTensor`](https://github.com/neil-tan/uTensor)
3. (done) Add template engine for richer flexibility
- [jinja2](http://jinja.pocoo.org)
4. (done?) core code generator implementation
- We need some refactoring, PRs are welcomed!
5. type alias in C/C++
- ex: use `uint8_t` or `unsigned char`?
- a lot more about this....
6. (done) `MANIFAST.in` for the `setup.py`
7. Relation among snippets/containers
- shared template variables? (headers, shared placeholders...etc)
8. Better configuration schema
- json
- yaml
- or ?
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
utensor_cgen-0.2.2.tar.gz
(30.8 kB
view details)
File details
Details for the file utensor_cgen-0.2.2.tar.gz
.
File metadata
- Download URL: utensor_cgen-0.2.2.tar.gz
- Upload date:
- Size: 30.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab9999aed1b80e22ede24def288408aca9c3adb33c9daaf92fa00a00e3c390c1 |
|
MD5 | 427552bcc50e2eac5aa2dbbf5e46073d |
|
BLAKE2b-256 | cca169cc80eac1a93ac2c91008dbf4d10972b61c24496606ae7e56b8b6d490df |