summaryrefslogtreecommitdiff
path: root/compiler/nnc/README.md
blob: 538811f2d46e25e1c2e3ed0484aeee1856c9ca69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# nnc
Neural Network Compiler

### DESCRIPTION

nnc is a neural network compiler that transforms neural networks of various formats into source or machine code.
> At this moment only two NN are supported (MobileNet and InceptionV3) in Tensorflow Lite or Caffe format.

### SYNOPSIS

nnc OPTIONS

### OPTIONS

        --help, -h            -    print usage and exit
        --caffe               -    treat input file as Caffe model
        --tflite              -    treat input file as Tensor Flow Lite model
        --target              -    select target language to emit for given architecture.
                                   Valid values are 'x86-c++', 'interpreter'
        --nnmodel, -m         -    specify input file with NN model
        --output, -o          -    specify name for output files
        --output-dir, -d      -    specify directory for output files
        --input-model-data    -    interpreter option: specify file with neural network input data.
                                   This file contains array of floats in binary form
        --input-node          -    interpreter option: set input node in Computational Graph
        --output-node         -    interpreter option: set output node in Computational Graph



### USAGE

Assuming that user has already installed nnc as follows:
```
$ cmake <path_to_nnc_sources> -DCMAKE_INSTALL_PREFIX=<path_to_install>
$ make all && make install
```

Also assuming that we have tflite model (for example inceptionv3.tflite)

**1. Running nnc in interpreter mode:**
```
<path_to_install>/bin/nnc \
--nnmodel inceptionv3.tflite \
--target interpreter \
--input-model-data data.file \
--input-node input --output-node output
```

**2. Running to generate C/C++ source code:**

```
<path_to_install>/bin/nnc \
--nnmodel inceptionv3.tflite \
--target x86-c++ \
--output inception \
--output-dir output_dir
```