Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
ff8ef9ed
MegEngine
项目概览
MegEngine 天元
/
MegEngine
大约 1 年 前同步成功
通知
399
Star
4705
Fork
582
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MegEngine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
ff8ef9ed
编写于
11月 11, 2020
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
docs(dnn): add comments of weight prerpocess interface
GitOrigin-RevId: bb496ed219dcb3bbb400617036273d5798cb053e
上级
13272eaa
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
81 addition
and
1 deletion
+81
-1
dnn/include/megdnn/oprs/nn.h
dnn/include/megdnn/oprs/nn.h
+81
-1
未找到文件。
dnn/include/megdnn/oprs/nn.h
浏览文件 @
ff8ef9ed
...
...
@@ -210,13 +210,25 @@ public:
/**
* \param[in] src (n, ic, ih, iw)
* \param[in] filter (oc, ic, fh, fw)
* \param[in] preprocessed_filter if weight no preprocessed it will be
* nullptr, else the preprocessed weights store in the tensors of
* preprocessed_filter.
* \param[in] workspace if weight no preprocessed
* (preprocessed_filter == nullptr), The size of the workspace satisfies the
* situation that weights is not processed, other wise the size of workspace
* satisfies the situation that weights is preprocessed
* \param[out] dst (n, oc, oh, ow)
*/
virtual
void
exec
(
_megdnn_tensor_in
src
,
_megdnn_tensor_in
filter
,
_megdnn_tensor_out
dst
,
const
PreprocessedFilter
*
preprocessed_filter
,
_megdnn_workspace
workspace
)
=
0
;
/**
* \brief execute weight preprocessing, read weights form filter and write to
* preprocessed_filter after preprocessed.
*
* \praram[in] workspace the needed tmp workspace when exec_preprocess
*/
virtual
void
exec_preprocess
(
const
TensorLayout
&
src_layout
,
_megdnn_tensor_in
filter
,
const
TensorLayout
&
dst_layout
,
...
...
@@ -226,15 +238,39 @@ public:
void
deduce_layout
(
const
TensorLayout
&
src
,
const
TensorLayout
&
filter
,
TensorLayout
&
dst
);
/**
* \brief query the workspace needed when executing the opr, if the weights
* are preprocessed the preprocessed_filter will not be nullptr, else it
* will be nullptr, the workspace size maybe different whether weights are
* preprocessed
*
* \return the size of workspace needed when executing
*/
virtual
size_t
get_workspace_in_bytes
(
const
TensorLayout
&
src
,
const
TensorLayout
&
filter
,
const
TensorLayout
&
dst
,
const
PreprocessedFilter
*
preprocessed_filter
)
=
0
;
/**
* \brief deduce the preprocessed filter layouts according to the src,
* filter and dst layout, the result may contain multi layouts when the
* weights is not one
*
* \return SmallVector<TensorLayout> Derive the layouts of weight
* preprocessing, return empty if preprocessing is not needed.
*/
virtual
SmallVector
<
TensorLayout
>
deduce_preprocessed_filter_layout
(
const
TensorLayout
&
src
,
const
TensorLayout
&
filter
,
const
TensorLayout
&
dst
)
=
0
;
/**
* \brief query the workspace needed when preprocessing the weights,
* according to the return size, a _megdnn_workspace will be created and
* passed through exec_preprocess
*
* \return the size of workspace needed when preprocessing
*/
virtual
size_t
get_preprocess_workspace_in_bytes
(
const
TensorLayout
&
src
,
const
TensorLayout
&
filter
,
const
TensorLayout
&
dst
)
=
0
;
...
...
@@ -323,6 +359,13 @@ public:
* 4 * ic)
* \param[in] bias (1, oc, 1, 1)
* \param[in] z same as dst
* \param[in] preprocessed_filter if weight no preprocessed it will be
* nullptr, else the preprocessed weights store in the tensors of
* preprocessed_filter.
* \param[in] workspace if weight no preprocessed
* (preprocessed_filter == nullptr), The size of the workspace satisfies the
* situation that weights is not processed, other wise the size of workspace
* satisfies the situation that weights is preprocessed
* \param[out] dst (n, oc, oh, ow) or (n, oh, ow, oc)
*
* \note if the format is NCHW_WINOGRAD, the filter layout is (alphah,
...
...
@@ -333,6 +376,14 @@ public:
_megdnn_tensor_out
dst
,
const
PreprocessedFilter
*
preprocessed_filter
,
_megdnn_workspace
workspace
)
=
0
;
/**
* \brief execute weight preprocessing, read weights form filter and write
* to preprocessed_filter after preprocessed.
*
* \praram[in] workspace the needed tmp workspace when exec_preprocess
* running, the size is got by get_preprocess_workspace_in_bytes
*/
virtual
void
exec_preprocess
(
const
TensorLayout
&
src_layout
,
_megdnn_tensor_in
filter
,
const
TensorLayout
&
bias_layout
,
...
...
@@ -345,20 +396,49 @@ public:
const
TensorLayout
&
bias
,
const
TensorLayout
&
z
,
TensorLayout
&
dst
);
/**
* \brief query the workspace needed when executing the opr, if the weights
* are preprocessed the preprocessed_filter will not be nullptr, else it
* will be nullptr, the workspace size maybe different whether weights are
* preprocessed
*
* \return the size of workspace needed when executing
*/
virtual
size_t
get_workspace_in_bytes
(
const
TensorLayout
&
src
,
const
TensorLayout
&
filter
,
const
TensorLayout
&
bias
,
const
TensorLayout
&
z
,
const
TensorLayout
&
dst
,
const
PreprocessedFilter
*
preprocessed_filter
)
=
0
;
/**
* \brief query the workspace needed when pre-processing the weights,
* according to the return size, a _megdnn_workspace will be created and
* passed through exec_preprocess
*
* \return the size of workspace needed when pre-processing
*/
virtual
size_t
get_preprocess_workspace_in_bytes
(
const
TensorLayout
&
src
,
const
TensorLayout
&
filter
,
const
TensorLayout
&
bias
,
const
TensorLayout
&
z
,
const
TensorLayout
&
dst
)
=
0
;
/**
* \brief deduce the pre-processed filter layouts according to the src,
* filter and dst layout, which may contain multi layouts when the weights
* is not one
*
* \return SmallVector<TensorLayout> Derive the layouts of weight
* preprocessing, return empty if preprocessing is not needed.
*/
virtual
SmallVector
<
TensorLayout
>
deduce_preprocessed_filter_layout
(
const
TensorLayout
&
src
,
const
TensorLayout
&
filter
,
const
TensorLayout
&
bias
,
const
TensorLayout
&
z
,
const
TensorLayout
&
dst
)
=
0
;
/**
* \brief deduce the origin filter layout and conv_bias param after winograd
* transform, this used in fast-run to construct the origin cache-key
*/
static
void
deduce_winograd_origin_layout_and_param
(
const
Param
::
Format
format
,
const
size_t
output_block_size
,
const
TensorLayout
&
src_layout
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录