Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
af3b4630
Mace
项目概览
Xiaomi
/
Mace
通知
106
Star
40
Fork
27
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mace
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
af3b4630
编写于
5月 11, 2018
作者:
L
Liangliang He
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update rst table format
上级
272f923e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
198 addition
and
171 deletion
+198
-171
docs/development/adding_a_new_op.md
docs/development/adding_a_new_op.md
+4
-0
docs/development/memory_layout.rst
docs/development/memory_layout.rst
+109
-54
docs/getting_started/create_a_model_deployment.rst
docs/getting_started/create_a_model_deployment.rst
+42
-38
docs/getting_started/op_lists.rst
docs/getting_started/op_lists.rst
+43
-79
未找到文件。
docs/development/adding_a_new_op.md
浏览文件 @
af3b4630
...
@@ -95,3 +95,7 @@ Add test and benchmark
...
@@ -95,3 +95,7 @@ Add test and benchmark
----------------------
----------------------
It's strongly recommended to add unit test and micro benchmark for your
It's strongly recommended to add unit test and micro benchmark for your
new Op. If you wish to contribute back, it's required.
new Op. If you wish to contribute back, it's required.
Document the new Op
---------------------
Finally, add an entry in operator table in the document.
docs/development/memory_layout.rst
浏览文件 @
af3b4630
...
@@ -5,17 +5,21 @@ CPU runtime memory layout
...
@@ -5,17 +5,21 @@ CPU runtime memory layout
-------------------------
-------------------------
The CPU tensor buffer is organized in the following order:
The CPU tensor buffer is organized in the following order:
+-----------------------------+--------------+
.. list-table::
| Tensor type | Buffer |
:widths: auto
+=============================+==============+
:header-rows: 1
| Intermediate input/output | NCHW |
:align: left
+-----------------------------+--------------+
| Convolution Filter | OIHW |
* - Tensor type
+-----------------------------+--------------+
- Buffer
| Depthwise Convolution Filter| MIHW |
* - Intermediate input/output
+-----------------------------+--------------+
- NCHW
| 1-D Argument, length = W | W |
* - Convolution Filter
+-----------------------------+--------------+
- OIHW
* - Depthwise Convolution Filter
- MIHW
* - 1-D Argument, length = W
- W
OpenCL runtime memory layout
OpenCL runtime memory layout
-----------------------------
-----------------------------
...
@@ -34,66 +38,117 @@ Input/Output Tensor
...
@@ -34,66 +38,117 @@ Input/Output Tensor
The Input/Output Tensor is stored in NHWC format:
The Input/Output Tensor is stored in NHWC format:
+---------------------------+--------+----------------------------+-----------------------------+
.. list-table::
|Tensor type | Buffer | Image size [width, height] | Explanation |
:widths: auto
+===========================+========+============================+=============================+
:header-rows: 1
|Channel-Major Input/Output | NHWC | [W * (C+3)/4, N * H] | Default Input/Output format |
:align: left
+---------------------------+--------+----------------------------+-----------------------------+
|Height-Major Input/Output | NHWC | [W * C, N * (H+3)/4] | Winograd Convolution format |
* - Tensor type
+---------------------------+--------+----------------------------+-----------------------------+
- Buffer
|Width-Major Input/Output | NHWC | [(W+3)/4 * C, N * H] | Winograd Convolution format |
- Image size [width, height]
+---------------------------+--------+----------------------------+-----------------------------+
- Explanation
* - Channel-Major Input/Output
- NHWC
- [W * (C+3)/4, N * H]
- Default Input/Output format
* - Height-Major Input/Output
- NHWC
- [W * C, N * (H+3)/4
- Winograd Convolution format
* - Width-Major Input/Output
- NHWC
- [(W+3)/4 * C, N * H]
- Winograd Convolution format
Each Pixel of **Image** contains 4 elements. The below table list the
Each Pixel of **Image** contains 4 elements. The below table list the
coordination relation between **Image** and **Buffer**.
coordination relation between **Image** and **Buffer**.
+---------------------------+-------------------------------------------------------------------------+-------------+
.. list-table::
|Tensor type | Pixel coordinate relationship | Explanation |
:widths: auto
+===========================+=========================================================================+=============+
:header-rows: 1
|Channel-Major Input/Output | P[i, j] = {E[n, h, w, c] | (n=j/H, h=j%H, w=i%W, c=[i/W * 4 + k])} | k=[0, 4) |
:align: left
+---------------------------+-------------------------------------------------------------------------+-------------+
|Height-Major Input/Output | P[i, j] = {E[n, h, w, c] | (n=j%N, h=[j/H*4 + k], w=i%W, c=i/W)} | k=[0, 4) |
* - Tensor type
+---------------------------+-------------------------------------------------------------------------+-------------+
- Pixel coordinate relationship
|Width-Major Input/Output | P[i, j] = {E[n, h, w, c] | (n=j/H, h=j%H, w=[i%W*4 + k], c=i/W)} | k=[0, 4) |
- Explanation
+---------------------------+-------------------------------------------------------------------------+-------------+
* - Channel-Major Input/Output
- P[i, j] = {E[n, h, w, c] | (n=j/H, h=j%H, w=i%W, c=[i/W * 4 + k])}
- k=[0, 4)
* - Height-Major Input/Output
- P[i, j] = {E[n, h, w, c] | (n=j%N, h=[j/H*4 + k], w=i%W, c=i/W)}
- k=[0, 4)
* - Width-Major Input/Output
- P[i, j] = {E[n, h, w, c] | (n=j/H, h=j%H, w=[i%W*4 + k], c=i/W)}
- k=[0, 4)
Filter Tensor
Filter Tensor
~~~~~~~~~~~~~
~~~~~~~~~~~~~
+----------------------------+------+---------------------------------+------------------------------------------------------------------------------+
.. list-table::
| Tensor |Buffer| Image size [width, height] | Explanation |
:widths: auto
+============================+======+=================================+==============================================================================+
:header-rows: 1
|Convolution Filter | HWOI | [RoundUp<4>(I), H * W * (O+3)/4]|Convolution filter format,There is no difference compared to [H*w*I, (O+3)/4]|
:align: left
+----------------------------+------+---------------------------------+------------------------------------------------------------------------------+
|Depthwise Convlution Filter | HWIM | [H * W * M, (I+3)/4] |Depthwise-Convolution filter format |
* - Tensor
+----------------------------+------+---------------------------------+------------------------------------------------------------------------------+
- Buffer
- Image size [width, height]
- Explanation
* - Convolution Filter
- HWOI
- [RoundUp<4>(I), H * W * (O+3)/4]
- Convolution filter format,There is no difference compared to [H*w*I, (O+3)/4]
* - Depthwise Convlution Filter
- HWIM
- [H * W * M, (I+3)/4]
- Depthwise-Convolution filter format
Each Pixel of **Image** contains 4 elements. The below table list the
Each Pixel of **Image** contains 4 elements. The below table list the
coordination relation between **Image** and **Buffer**.
coordination relation between **Image** and **Buffer**.
+----------------------------+-------------------------------------------------------------------+---------------------------------------+
.. list-table::
|Tensor type | Pixel coordinate relationship | Explanation |
:widths: auto
+============================+===================================================================+=======================================+
:header-rows: 1
|Convolution Filter | P[m, n] = {E[h, w, o, i] | (h=T/W, w=T%W, o=[n/HW*4+k], i=m)}| HW= H * W, T=n%HW, k=[0, 4) |
:align: left
+----------------------------+-------------------------------------------------------------------+---------------------------------------+
|Depthwise Convlution Filter | P[m, n] = {E[h, w, i, 0] | (h=m/W, w=m%W, i=[n*4+k])} | only support multiplier == 1, k=[0, 4)|
* - Tensor type
+----------------------------+-------------------------------------------------------------------+---------------------------------------+
- Pixel coordinate relationship
- Explanation
* - Convolution Filter
- P[m, n] = {E[h, w, o, i] | (h=T/W, w=T%W, o=[n/HW*4+k], i=m)}
- HW= H * W, T=n%HW, k=[0, 4)
* - Depthwise Convlution Filter
- P[m, n] = {E[h, w, i, 0] | (h=m/W, w=m%W, i=[n*4+k])}
- only support multiplier == 1, k=[0, 4)
1-D Argument Tensor
1-D Argument Tensor
~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~
+----------------+----------+------------------------------+---------------------------------+
.. list-table::
| Tensor type | Buffer | Image size [width, height] | Explanation |
:widths: auto
+================+==========+==============================+=================================+
:header-rows: 1
| 1-D Argument | W | [(W+3)/4, 1] | 1D argument format, e.g. Bias |
:align: left
+----------------+----------+------------------------------+---------------------------------+
* - Tensor type
- Buffer
- Image size [width, height]
- Explanation
* - 1-D Argument
- W
- [(W+3)/4, 1]
- 1D argument format, e.g. Bias
Each Pixel of **Image** contains 4 elements. The below table list the
Each Pixel of **Image** contains 4 elements. The below table list the
coordination relation between **Image** and **Buffer**.
coordination relation between **Image** and **Buffer**.
+--------------+---------------------------------+-------------+
.. list-table::
| Tensor type | Pixel coordinate relationship | Explanation |
:widths: auto
+==============+=================================+=============+
:header-rows: 1
|1-D Argument | P[i, 0] = {E[w] | w=i*4+k} | k=[0, 4) |
:align: left
+--------------+---------------------------------+-------------+
* - Tensor type
- Pixel coordinate relationship
- Explanation
* - 1-D Argument
- P[i, 0] = {E[w] | w=i*4+k}
- k=[0, 4)
docs/getting_started/create_a_model_deployment.rst
浏览文件 @
af3b4630
...
@@ -19,46 +19,50 @@ Here is an deployment file example used by Android demo application.
...
@@ -19,46 +19,50 @@ Here is an deployment file example used by Android demo application.
TODO: change this example file to the demo deployment file
TODO: change this example file to the demo deployment file
(reuse the same file) and rename to a reasonable name.
(reuse the same file) and rename to a reasonable name.
.. literalinclude
:: models/demo_app_models.yaml
.. literalinclude:: models/demo_app_models.yaml
:language: yaml
:language: yaml
Configurations
Configurations
--------------------
--------------------
+--------------------------+----------------------------------------------------------------------------------------+
.. list-table::
| Configuration key | Description |
:widths: auto
+==========================+========================================================================================+
:header-rows: 1
| target_abis | The target ABI to build, can be one or more of 'host', 'armeabi-v7a' or 'arm64-v8a' |
:align: left
+--------------------------+----------------------------------------------------------------------------------------+
| embed_model_data | Whether embedding model weights as the code, default to 1 |
* - Configuration key
+--------------------------+----------------------------------------------------------------------------------------+
- Description
| platform | The source framework, tensorflow or caffe |
* - target_abis
+--------------------------+----------------------------------------------------------------------------------------+
- The target ABI to build, can be one or more of 'host', 'armeabi-v7a' or 'arm64-v8a'
| model_file_path | The path of the model file, can be local or remote |
* - embed_model_data
+--------------------------+----------------------------------------------------------------------------------------+
- Whether embedding model weights as the code, default to 1
| weight_file_path | The path of the model weights file, used by Caffe model |
* - platform
+--------------------------+----------------------------------------------------------------------------------------+
- The source framework, tensorflow or caffe
| model_sha256_checksum | The SHA256 checksum of the model file |
* - model_file_path
+--------------------------+----------------------------------------------------------------------------------------+
- The path of the model file, can be local or remote
| weight_sha256_checksum | The SHA256 checksum of the weight file, used by Caffe model |
* - weight_file_path
+--------------------------+----------------------------------------------------------------------------------------+
- The path of the model weights file, used by Caffe model
| input_nodes | The input node names, one or more strings |
* - model_sha256_checksum
+--------------------------+----------------------------------------------------------------------------------------+
- The SHA256 checksum of the model file
| output_nodes | The output node names, one or more strings |
* - weight_sha256_checksum
+--------------------------+----------------------------------------------------------------------------------------+
- The SHA256 checksum of the weight file, used by Caffe model
| input_shapes | The shapes of the input nodes, in NHWC order |
* - input_nodes
+--------------------------+----------------------------------------------------------------------------------------+
- The input node names, one or more strings
| output_shapes | The shapes of the output nodes, in NHWC order |
* - output_nodes
+--------------------------+----------------------------------------------------------------------------------------+
- The output node names, one or more strings
| runtime | The running device, one of CPU, GPU or DSP |
* - input_shapes
+--------------------------+----------------------------------------------------------------------------------------+
- The shapes of the input nodes, in NHWC order
| limit_opencl_kernel_time | Whether splitting the OpenCL kernel within 1 ms to keep UI responsiveness, default to 0|
* - output_shapes
+--------------------------+----------------------------------------------------------------------------------------+
- The shapes of the output nodes, in NHWC order
| dsp_mode | Control the DSP precision and performance, default to 0 usually works for most cases |
* - runtime
+--------------------------+----------------------------------------------------------------------------------------+
- The running device, one of CPU, GPU or DSP
| obfuscate | Whether to obfuscate the model operator name, default to 0 |
* - limit_opencl_kernel_time
+--------------------------+----------------------------------------------------------------------------------------+
- Whether splitting the OpenCL kernel within 1 ms to keep UI responsiveness, default to 0
| fast_conv | Whether to enable Winograd convolution, **will increase memory consumption** |
* - dsp_mode
+--------------------------+----------------------------------------------------------------------------------------+
- Control the DSP precision and performance, default to 0 usually works for most cases
| input_files | Specify Numpy validation inputs. When not provided, [-1, 1] random values will be used |
* - obfuscate
+--------------------------+----------------------------------------------------------------------------------------+
- Whether to obfuscate the model operator name, default to 0
* - fast_conv
- Whether to enable Winograd convolution, **will increase memory consumption**
* - input_files
- Specify Numpy validation inputs. When not provided, [-1, 1] random values will be used
docs/getting_started/op_lists.rst
浏览文件 @
af3b4630
Operator lists
Operator lists
==============
==============
+----------------------------------+--------------+--------+-------------------------------------------------------+
.. Please keep in chronological order when editing
| Operator | Android NN | Status | Remark |
.. csv-table::
+==================================+==============+========+=======================================================+
:widths: auto
| ADD | Y | Y | |
:header: "Operator","Android NN","Supported","Remark"
+----------------------------------+--------------+--------+-------------------------------------------------------+
| AVERAGE\_POOL\_2D | Y | Y | |
"ADD","Y","Y",""
+----------------------------------+--------------+--------+-------------------------------------------------------+
"AVERAGE_POOL_2D","Y","Y",""
| BATCH\_NORM | | Y | Fusion with activation is supported |
"BATCH_NORM","","Y","Fusion with activation is supported"
+----------------------------------+--------------+--------+-------------------------------------------------------+
"BIAS_ADD","","Y",""
| BIAS\_ADD | | Y | |
"CHANNEL_SHUFFLE","","Y",""
+----------------------------------+--------------+--------+-------------------------------------------------------+
"CONCATENATION","Y","Y",""
| CHANNEL\_SHUFFLE | | Y | |
"CONV_2D","Y","Y","Fusion with BN and activation layer is supported"
+----------------------------------+--------------+--------+-------------------------------------------------------+
"DEPTHWISE_CONV_2D","Y","Y","Only multiplier = 1 is supported; Fusion is supported"
| CONCATENATION | Y | Y | |
"DEPTH_TO_SPACE","Y","Y",""
+----------------------------------+--------------+--------+-------------------------------------------------------+
"DEQUANTIZE","Y","",""
| CONV\_2D | Y | Y | Fusion with BN and activation layer is supported |
"EMBEDDING_LOOKUP","Y","",""
+----------------------------------+--------------+--------+-------------------------------------------------------+
"FLOOR","Y","",""
| DEPTHWISE\_CONV\_2D | Y | Y | Only multiplier = 1 is supported; Fusion is supported |
"FULLY_CONNECTED","Y","Y",""
+----------------------------------+--------------+--------+-------------------------------------------------------+
"GROUP_CONV_2D","","",""
| DEPTH\_TO\_SPACE | Y | Y | |
"HASHTABLE_LOOKUP","Y","",""
+----------------------------------+--------------+--------+-------------------------------------------------------+
"L2_NORMALIZATION","Y","",""
| DEQUANTIZE | Y | | |
"L2_POOL_2D","Y","",""
+----------------------------------+--------------+--------+-------------------------------------------------------+
"LOCAL_RESPONSE_NORMALIZATION","Y","Y",""
| EMBEDDING\_LOOKUP | Y | | |
"LOGISTIC","Y","Y",""
+----------------------------------+--------------+--------+-------------------------------------------------------+
"LSH_PROJECTION","Y","",""
| FLOOR | Y | | |
"LSTM","Y","",""
+----------------------------------+--------------+--------+-------------------------------------------------------+
"MATMUL","","Y",""
| FULLY\_CONNECTED | Y | Y | |
"MAX_POOL_2D","Y","Y",""
+----------------------------------+--------------+--------+-------------------------------------------------------+
"MUL","Y","",""
| GROUP\_CONV\_2D | | | |
"PSROI_ALIGN","","Y",""
+----------------------------------+--------------+--------+-------------------------------------------------------+
"PRELU","","Y",""
| HASHTABLE\_LOOKUP | Y | | |
"RELU","Y","Y",""
+----------------------------------+--------------+--------+-------------------------------------------------------+
"RELU1","Y","Y",""
| L2\_NORMALIZATION | Y | | |
"RELU6","Y","Y",""
+----------------------------------+--------------+--------+-------------------------------------------------------+
"RELUX","","Y",""
| L2\_POOL\_2D | Y | | |
"RESHAPE","Y","Y","Limited support"
+----------------------------------+--------------+--------+-------------------------------------------------------+
"RESIZE_BILINEAR","Y","Y",""
| LOCAL\_RESPONSE\_NORMALIZATION | Y | Y | |
"RNN","Y","",""
+----------------------------------+--------------+--------+-------------------------------------------------------+
"RPN_PROPOSAL_LAYER","","Y",""
| LOGISTIC | Y | Y | |
"SOFTMAX","Y","Y",""
+----------------------------------+--------------+--------+-------------------------------------------------------+
"SPACE_TO_DEPTH","Y","Y",""
| LSH\_PROJECTION | Y | | |
"SVDF","Y","",""
+----------------------------------+--------------+--------+-------------------------------------------------------+
"TANH","Y","Y",""
| LSTM | Y | | |
+----------------------------------+--------------+--------+-------------------------------------------------------+
| MATMUL | | Y | |
+----------------------------------+--------------+--------+-------------------------------------------------------+
| MAX\_POOL\_2D | Y | Y | |
+----------------------------------+--------------+--------+-------------------------------------------------------+
| MUL | Y | | |
+----------------------------------+--------------+--------+-------------------------------------------------------+
| PSROI\_ALIGN | | Y | |
+----------------------------------+--------------+--------+-------------------------------------------------------+
| PRELU | | Y | |
+----------------------------------+--------------+--------+-------------------------------------------------------+
| RELU | Y | Y | |
+----------------------------------+--------------+--------+-------------------------------------------------------+
| RELU1 | Y | Y | |
+----------------------------------+--------------+--------+-------------------------------------------------------+
| RELU6 | Y | Y | |
+----------------------------------+--------------+--------+-------------------------------------------------------+
| RELUX | | Y | |
+----------------------------------+--------------+--------+-------------------------------------------------------+
| RESHAPE | Y | Y | Limited support |
+----------------------------------+--------------+--------+-------------------------------------------------------+
| RESIZE\_BILINEAR | Y | Y | |
+----------------------------------+--------------+--------+-------------------------------------------------------+
| RNN | Y | | |
+----------------------------------+--------------+--------+-------------------------------------------------------+
| RPN\_PROPOSAL\_LAYER | | Y | |
+----------------------------------+--------------+--------+-------------------------------------------------------+
| SOFTMAX | Y | Y | |
+----------------------------------+--------------+--------+-------------------------------------------------------+
| SPACE\_TO\_DEPTH | Y | Y | |
+----------------------------------+--------------+--------+-------------------------------------------------------+
| SVDF | Y | | |
+----------------------------------+--------------+--------+-------------------------------------------------------+
| TANH | Y | Y | |
+----------------------------------+--------------+--------+-------------------------------------------------------+
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录