summaryrefslogtreecommitdiff
path: root/compiler/moco-tf/README.md
blob: add1159e1eb3e7a127fc233e67c3f9a23220fdf8 (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
# moco-tf

_moco-tf_ translates a TensorFlow model into _loco_

## Purpose

_moco-tf_ is to convert TensorFlow generated model file to in-memory _loco_ IR Graph.

## How to use

```cxx
#include <moco/tf/Frontend.h>

...

  ::moco::tf::Frontend moco;

  std::string pb_path = "path_to_pb_file_to_load";

  auto loco_graph = moco.load(sig, pb_path, ::moco::tf::Frontend::FileType::Binary);
```

## Dependency

Please refer [requires.cmake](./requires.cmake) for dependant modules.

## Naming rules

### TensorFlow node names

Use `REGISTER_OP` argument used in TensorFlow source `core` folder.

```
cd tensorflow/core
grep -Rn "REGISTER_OP"
```

To see single Op, `Conv2D` for example
```
cd tensorflow/core
grep -Rn "REGISTER_OP" | grep "Conv2D"
```

### Names related with TensorFlow nodes

Like `GraphBuilder` and `Canonicalization`, TensorFlow node names can be used as
prefix or suffix.

- `Conv2DGraphBuilder`
- `Conv2DCanonicalizier`

### TensorFlow Dialect IR

Use `TF` prefix with TensorFlow Dialect node names

- `TFAvgPool`
- `TFConv2D`