[moco.tf] Add Conversion.md (#3894)
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Fri, 21 Jun 2019 01:55:21 +0000 (10:55 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Fri, 21 Jun 2019 01:55:21 +0000 (10:55 +0900)
This commit adds Conversion.md which describes how to express each
T/F operation on top of loco.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/moco/lib/frontend/tf/doc/Conversion.md [new file with mode: 0644]

diff --git a/contrib/moco/lib/frontend/tf/doc/Conversion.md b/contrib/moco/lib/frontend/tf/doc/Conversion.md
new file mode 100644 (file)
index 0000000..3d69f24
--- /dev/null
@@ -0,0 +1,45 @@
+This document outlines how to express each TensorFlow operation on top of _loco_
+
+**CAUTION** All the python examples below are written in Python 3 with TensorFlow v1.13.
+
+**DISCLAIMER** _loco_ does not support named values, but all the below _loco_ examples assign "name" to each value to make it easy to read.
+
+### Placeholder
+
+**Placeholder** in _TensorFlow_ corresponds to **Pull** in _loco_.
+
+_Python_:
+```python
+import tensorflow as tf
+input = tf.placeholder(dtype=tf.float32, shape=[3, 4], name='input')
+print(tf.get_default_graph().as_graph_def())
+```
+
+API reference: [tf.placeholder](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf)
+
+_TensorFlow_
+```prototext
+node {
+  name: "input"
+  op: "Placeholder"
+  attr {
+    key: "dtype"
+    value { type: DT_FLOAT }
+  }
+  attr {
+    key: "shape"
+    value {
+      shape {
+        dim { size: 3 }
+        dim { size: 4 }
+      }
+    }
+  }
+}
+```
+
+_loco_:
+```
+%input = Pull(dtype: FLOAT32, shape: [3, 4])
+Push(%input)
+```