From ebad62ab02619a90c1b92b7cdd433847f6b8119b Mon Sep 17 00:00:00 2001 From: "jing.tang" Date: Mon, 31 May 2021 14:59:59 +0800 Subject: [PATCH] [NNRT-1111] add memory layout for doc --- docs/Operators.md.template | 20 ++++++++++++++++++++ include/tim/vx/ops/conv2d.h | 8 +++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/Operators.md.template b/docs/Operators.md.template index 8b12ab2..e99ba27 100644 --- a/docs/Operators.md.template +++ b/docs/Operators.md.template @@ -1,3 +1,23 @@ +# Memory Layout + +There are two different memory layout mode: + +- Row-Major. Also called C contiguous, which is firstly introduced in C by AT&T Bell Lab(1960s). Caffe/TensorFlow/Pytorch follow the Row-Major layout mode. + +- Column-Major. Also called Fortran contiguous, which is firstly introduced in Fortran by IBM(1958). Matlab/OpenGL/OpenCL/OpenVX follow the Column-Major layout mode. + +See also : + +http://eigen.tuxfamily.org/dox/group__TopicStorageOrders.html + +On the other hand, a memory layout can be described by both Row-Major and Column-Major mode. + +It easily tranlate the layout mode from one to another: just reverse the dimesions of the tensor. + +For example, TensorFlow usually describe the tensor as NHWC format. This is equal the CWHN format in OpenVX. + +Likewise, the WHCN format in OpenVX is equal the NCHW format in Caffe. + # Operators {DOCS} diff --git a/include/tim/vx/ops/conv2d.h b/include/tim/vx/ops/conv2d.h index fb5dec5..c94bf7f 100644 --- a/include/tim/vx/ops/conv2d.h +++ b/include/tim/vx/ops/conv2d.h @@ -37,11 +37,17 @@ namespace ops { * * Performs a 2-D convolution operation, include classic Conv2D / * Depthwise Conv2D / Group Conv2D / Dilation Conv2D. + * + * Input: + * - input [WHCN or CWHN]. + * - kernel [ WHIcOc ] (Ic: Input Channels. Oc: Output Channels). + * - bias [ O ]. Optional. * + * Attribute: * - weights : the output channel number for weight tensor. * - ksize : the height and width for weight tensor. * - padding : AUTO, VALID or SAME. - * - pad : pad value for each spatial axis. + * - pad : pad value for each spatial axis. * - stride : stride along each spatial axis. * - dilation : dilation value along each spatial axis of the filter. * - multiplier: function similar to group attribute on other framework,