Skip to main content

C code generation program for uTensor

Project description

# Installation (Python 2 & 3)

## For Users

- with `setup.py`
```
python setup.py install
```

- with `pip`
```
pip install utensor_cgen
```

## For Developers:

- with `pip`
```
pip instal -e .[dev]
```

- with `pipenv`
1. `$ PIPENV_VENV_IN_PROJECT=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

You can go to this [repo](https://github.com/pypa/pipenv) for detail information about `pipenv`.

**Note**: If you have trouble with installation using `pipenv`, try `PIPENV_VENV_IN_PROJECT=1 pipenv install -d --skip-lock`

### If All Fails...

1. You can use `docker`
- run `docker pull dboyliao/utensor-cli` for a pre-build docker image
- or run `docker build -t <user_name>/utensor-cli .` to build the docker image
by yourself, where `<user_name>` can be any user name you want.
2. Run the docker image
- `docker run -it dboyliao/utensor-cli`
- or `docker run -it <user_name>/utensor-cli` if you want to use the image you just
build.

Please refer to `docker` [documentation](https://docs.docker.com/get-started/) for detail.

# 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?) core code generator implementation
- We need some refactoring, PRs are welcomed!
2. type alias in C/C++
- ex: use `uint8_t` or `unsigned char`?
- a lot more about this....
3. Relation among snippets/containers
- shared template variables? (headers, shared placeholders...etc)
4. Better configuration schema
- json
- yaml
- or ?

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

utensor_cgen-0.2.3.tar.gz (31.0 kB view details)

Uploaded Source

File details

Details for the file utensor_cgen-0.2.3.tar.gz.

File metadata

File hashes

Hashes for utensor_cgen-0.2.3.tar.gz
Algorithm Hash digest
SHA256 29c66a5443e9479504599db36a7838d139e363be0401929118759c51e664c6e8
MD5 4c141f70f4fd052aeb6a799857af8449
BLAKE2b-256 913f7805db3a2e36baff8f8628f3023b5ec5f48fb0211725d9f26b9048105a16

See more details on using hashes here.

Supported by

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