Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
935fe781
MegEngine
项目概览
MegEngine 天元
/
MegEngine
1 年多 前同步成功
通知
403
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看板
提交
935fe781
编写于
12月 22, 2020
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore(megbrain): format sereg.h code
GitOrigin-RevId: 0fe1cf6a8b52e9f9e4f53de65434c965d5d272d7
上级
55042195
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
709 addition
and
728 deletion
+709
-728
src/opr/impl/dnn/dnn.sereg.h
src/opr/impl/dnn/dnn.sereg.h
+535
-553
src/opr/impl/imgproc.sereg.h
src/opr/impl/imgproc.sereg.h
+174
-175
未找到文件。
src/opr/impl/dnn/dnn.sereg.h
浏览文件 @
935fe781
此差异已折叠。
点击以展开。
src/opr/impl/imgproc.sereg.h
浏览文件 @
935fe781
...
...
@@ -9,195 +9,194 @@
* "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
#include <type_traits>
//
#include <type_traits>
#include "megbrain/opr/imgproc.h"
#include "megbrain/serialization/sereg.h"
#include "megdnn/opr_param_defs.h"
namespace
mgb
{
namespace
serialization
{
//! OprMaker implementation for operators with variadic arguments
template
<
>
struct
OprMaker
<
opr
::
WarpPerspective
,
0
>
{
using
Opr
=
opr
::
WarpPerspective
;
using
Param
=
Opr
::
Param
;
static
cg
::
OperatorNodeBase
*
make
(
const
Param
&
param
,
const
cg
::
VarNodeArray
&
inputs
,
ComputingGraph
&
graph
,
const
OperatorNodeConfig
&
config
)
{
MGB_MARK_USED_VAR
(
graph
);
if
(
inputs
.
size
()
==
3
)
{
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
param
,
config
)
.
node
()
->
owner_opr
();
}
else
{
mgb_assert
(
inputs
.
size
()
==
4
);
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
inputs
[
3
],
param
,
config
)
.
node
()
->
owner_opr
();
}
//! OprMaker implementation for operators with variadic arguments
template
<
>
struct
OprMaker
<
opr
::
WarpPerspective
,
0
>
{
using
Opr
=
opr
::
WarpPerspective
;
using
Param
=
Opr
::
Param
;
static
cg
::
OperatorNodeBase
*
make
(
const
Param
&
param
,
const
cg
::
VarNodeArray
&
inputs
,
ComputingGraph
&
graph
,
const
OperatorNodeConfig
&
config
)
{
MGB_MARK_USED_VAR
(
graph
);
if
(
inputs
.
size
()
==
3
)
{
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
param
,
config
)
.
node
()
->
owner_opr
();
}
else
{
mgb_assert
(
inputs
.
size
()
==
4
);
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
inputs
[
3
],
param
,
config
)
.
node
()
->
owner_opr
();
}
}
;
template
<
>
struct
OprMaker
<
opr
::
Remap
,
0
>
{
using
Opr
=
opr
::
Remap
;
using
Param
=
Opr
::
Param
;
static
cg
::
OperatorNodeBase
*
make
(
const
Param
&
param
,
const
cg
::
VarNodeArray
&
inputs
,
ComputingGraph
&
graph
,
const
OperatorNodeConfig
&
config
)
{
MGB_MARK_USED_VAR
(
graph
);
if
(
inputs
.
size
()
==
2
)
{
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
param
,
config
)
.
node
(
)
->
owner_opr
();
}
else
{
return
nullptr
;
}
}
};
template
<
>
struct
OprMaker
<
opr
::
Remap
,
0
>
{
using
Opr
=
opr
::
Remap
;
using
Param
=
Opr
::
Param
;
static
cg
::
OperatorNodeBase
*
make
(
const
Param
&
param
,
const
cg
::
VarNodeArray
&
inputs
,
ComputingGraph
&
graph
,
const
OperatorNodeConfig
&
config
)
{
MGB_MARK_USED_VAR
(
graph
);
if
(
inputs
.
size
()
==
2
)
{
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
param
,
config
)
.
node
()
->
owner_opr
();
}
else
{
return
nullptr
;
}
}
;
template
<
>
struct
OprMaker
<
opr
::
RemapBackwardMat
,
0
>
{
using
Opr
=
opr
::
RemapBackwardMat
;
using
Param
=
Opr
::
Param
;
static
cg
::
OperatorNodeBase
*
make
(
const
Param
&
param
,
const
cg
::
VarNodeArray
&
inputs
,
ComputingGraph
&
graph
,
const
OperatorNodeConfig
&
config
)
{
MGB_MARK_USED_VAR
(
graph
);
if
(
inputs
.
size
()
==
3
)
{
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
param
,
config
)
.
node
(
)
->
owner_opr
();
}
else
{
return
nullptr
;
}
}
};
template
<
>
struct
OprMaker
<
opr
::
RemapBackwardMat
,
0
>
{
using
Opr
=
opr
::
RemapBackwardMat
;
using
Param
=
Opr
::
Param
;
static
cg
::
OperatorNodeBase
*
make
(
const
Param
&
param
,
const
cg
::
VarNodeArray
&
inputs
,
ComputingGraph
&
graph
,
const
OperatorNodeConfig
&
config
)
{
MGB_MARK_USED_VAR
(
graph
);
if
(
inputs
.
size
()
==
3
)
{
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
param
,
config
)
.
node
()
->
owner_opr
();
}
else
{
return
nullptr
;
}
}
;
template
<
>
struct
OprMaker
<
opr
::
RemapBackwardData
,
0
>
{
using
Opr
=
opr
::
RemapBackwardData
;
using
Param
=
Opr
::
Param
;
static
cg
::
OperatorNodeBase
*
make
(
const
Param
&
param
,
const
cg
::
VarNodeArray
&
inputs
,
ComputingGraph
&
graph
,
const
OperatorNodeConfig
&
config
)
{
MGB_MARK_USED_VAR
(
graph
);
if
(
inputs
.
size
()
==
3
)
{
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
param
,
config
)
.
node
(
)
->
owner_opr
();
}
else
{
return
nullptr
;
}
}
};
template
<
>
struct
OprMaker
<
opr
::
RemapBackwardData
,
0
>
{
using
Opr
=
opr
::
RemapBackwardData
;
using
Param
=
Opr
::
Param
;
static
cg
::
OperatorNodeBase
*
make
(
const
Param
&
param
,
const
cg
::
VarNodeArray
&
inputs
,
ComputingGraph
&
graph
,
const
OperatorNodeConfig
&
config
)
{
MGB_MARK_USED_VAR
(
graph
);
if
(
inputs
.
size
()
==
3
)
{
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
param
,
config
)
.
node
()
->
owner_opr
();
}
else
{
return
nullptr
;
}
}
;
template
<
>
struct
OprMaker
<
opr
::
DctChannelSelectForward
,
0
>
{
using
Opr
=
opr
::
DctChannelSelectForward
;
using
Param
=
Opr
::
Param
;
static
cg
::
OperatorNodeBase
*
make
(
const
Param
&
param
,
const
cg
::
VarNodeArray
&
inputs
,
ComputingGraph
&
graph
,
const
OperatorNodeConfig
&
config
)
{
MGB_MARK_USED_VAR
(
graph
);
if
(
inputs
.
size
()
==
3
)
{
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
param
,
config
)
.
node
(
)
->
owner_opr
();
}
else
{
mgb_assert
(
inputs
.
size
()
==
1
);
return
Opr
::
make
(
inputs
[
0
],
param
,
config
).
node
()
->
owner_opr
(
);
}
}
};
template
<
>
struct
OprMaker
<
opr
::
DctChannelSelectForward
,
0
>
{
using
Opr
=
opr
::
DctChannelSelectForward
;
using
Param
=
Opr
::
Param
;
static
cg
::
OperatorNodeBase
*
make
(
const
Param
&
param
,
const
cg
::
VarNodeArray
&
inputs
,
ComputingGraph
&
graph
,
const
OperatorNodeConfig
&
config
)
{
MGB_MARK_USED_VAR
(
graph
);
if
(
inputs
.
size
()
==
3
)
{
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
param
,
config
)
.
node
()
->
owner_opr
();
}
else
{
mgb_assert
(
inputs
.
size
()
==
1
);
return
Opr
::
make
(
inputs
[
0
],
param
,
config
).
node
()
->
owner_opr
();
}
}
;
template
<
>
struct
OprMaker
<
opr
::
WarpPerspectiveBackwardData
,
0
>
{
using
Opr
=
opr
::
WarpPerspectiveBackwardData
;
using
Param
=
Opr
::
Param
;
static
cg
::
OperatorNodeBase
*
make
(
const
Param
&
param
,
const
cg
::
VarNodeArray
&
inputs
,
ComputingGraph
&
graph
,
const
OperatorNodeConfig
&
config
)
{
MGB_MARK_USED_VAR
(
graph
);
if
(
inputs
.
size
()
==
3
)
{
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
param
,
config
)
.
node
(
)
->
owner_opr
();
}
else
{
mgb_assert
(
inputs
.
size
()
==
4
);
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
inputs
[
3
],
param
,
config
)
.
node
(
)
->
owner_opr
();
}
}
};
template
<
>
struct
OprMaker
<
opr
::
WarpPerspectiveBackwardData
,
0
>
{
using
Opr
=
opr
::
WarpPerspectiveBackwardData
;
using
Param
=
Opr
::
Param
;
static
cg
::
OperatorNodeBase
*
make
(
const
Param
&
param
,
const
cg
::
VarNodeArray
&
inputs
,
ComputingGraph
&
graph
,
const
OperatorNodeConfig
&
config
)
{
MGB_MARK_USED_VAR
(
graph
);
if
(
inputs
.
size
()
==
3
)
{
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
param
,
config
)
.
node
()
->
owner_opr
();
}
else
{
mgb_assert
(
inputs
.
size
()
==
4
);
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
inputs
[
3
],
param
,
config
)
.
node
()
->
owner_opr
();
}
}
;
template
<
>
struct
OprMaker
<
opr
::
WarpPerspectiveBackwardMat
,
0
>
{
using
Opr
=
opr
::
WarpPerspectiveBackwardMat
;
using
Param
=
Opr
::
Param
;
static
cg
::
OperatorNodeBase
*
make
(
const
Param
&
param
,
const
cg
::
VarNodeArray
&
inputs
,
ComputingGraph
&
graph
,
const
OperatorNodeConfig
&
config
)
{
MGB_MARK_USED_VAR
(
graph
);
if
(
inputs
.
size
()
==
3
)
{
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
param
,
config
)
.
node
(
)
->
owner_opr
();
}
else
{
mgb_assert
(
inputs
.
size
()
==
4
);
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
inputs
[
3
],
param
,
config
)
.
node
(
)
->
owner_opr
();
}
}
};
template
<
>
struct
OprMaker
<
opr
::
WarpPerspectiveBackwardMat
,
0
>
{
using
Opr
=
opr
::
WarpPerspectiveBackwardMat
;
using
Param
=
Opr
::
Param
;
static
cg
::
OperatorNodeBase
*
make
(
const
Param
&
param
,
const
cg
::
VarNodeArray
&
inputs
,
ComputingGraph
&
graph
,
const
OperatorNodeConfig
&
config
)
{
MGB_MARK_USED_VAR
(
graph
);
if
(
inputs
.
size
()
==
3
)
{
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
param
,
config
)
.
node
()
->
owner_opr
();
}
else
{
mgb_assert
(
inputs
.
size
()
==
4
);
return
Opr
::
make
(
inputs
[
0
],
inputs
[
1
],
inputs
[
2
],
inputs
[
3
],
param
,
config
)
.
node
()
->
owner_opr
();
}
};
}
// namespace serialization
}
};
}
// namespace serialization
namespace
opr
{
using
WarpPerspectiveV2
=
WarpPerspective
;
using
WarpPerspectiveBackwardDataV2
=
WarpPerspectiveBackwardData
;
using
WarpPerspectiveBackwardMatV2
=
WarpPerspectiveBackwardMat
;
MGB_SEREG_OPR
(
WarpPerspectiveV2
,
0
);
MGB_SEREG_OPR
(
WarpPerspectiveBackwardDataV2
,
0
);
MGB_SEREG_OPR
(
WarpPerspectiveBackwardMatV2
,
0
);
MGB_SEREG_OPR
(
Rotate
,
1
);
MGB_SEREG_OPR
(
CvtColor
,
1
);
MGB_SEREG_OPR
(
GaussianBlur
,
1
);
MGB_SEREG_OPR
(
ResizeBackward
,
2
);
using
RemapV1
=
Remap
;
using
RemapBackwardDataV1
=
RemapBackwardData
;
using
RemapBackwardMatV1
=
RemapBackwardMat
;
MGB_SEREG_OPR
(
RemapV1
,
2
);
MGB_SEREG_OPR
(
RemapBackwardDataV1
,
3
);
MGB_SEREG_OPR
(
RemapBackwardMatV1
,
3
);
//! current warp affine version
using
WarpAffineV2
=
opr
::
WarpAffine
;
MGB_SEREG_OPR
(
WarpAffineV2
,
3
);
//! current resize version
using
ResizeV2
=
opr
::
Resize
;
MGB_SEREG_OPR
(
ResizeV2
,
2
);
using
DctChannelSelectV1
=
opr
::
DctChannelSelect
;
MGB_SEREG_OPR
(
DctChannelSelectV1
,
0
);
}
// namespace opr
}
// namespace mgb
using
WarpPerspectiveV2
=
WarpPerspective
;
using
WarpPerspectiveBackwardDataV2
=
WarpPerspectiveBackwardData
;
using
WarpPerspectiveBackwardMatV2
=
WarpPerspectiveBackwardMat
;
MGB_SEREG_OPR
(
WarpPerspectiveV2
,
0
);
MGB_SEREG_OPR
(
WarpPerspectiveBackwardDataV2
,
0
);
MGB_SEREG_OPR
(
WarpPerspectiveBackwardMatV2
,
0
);
MGB_SEREG_OPR
(
Rotate
,
1
);
MGB_SEREG_OPR
(
CvtColor
,
1
);
MGB_SEREG_OPR
(
GaussianBlur
,
1
);
MGB_SEREG_OPR
(
ResizeBackward
,
2
);
using
RemapV1
=
Remap
;
using
RemapBackwardDataV1
=
RemapBackwardData
;
using
RemapBackwardMatV1
=
RemapBackwardMat
;
MGB_SEREG_OPR
(
RemapV1
,
2
);
MGB_SEREG_OPR
(
RemapBackwardDataV1
,
3
);
MGB_SEREG_OPR
(
RemapBackwardMatV1
,
3
);
//! current warp affine version
using
WarpAffineV2
=
opr
::
WarpAffine
;
MGB_SEREG_OPR
(
WarpAffineV2
,
3
);
//! current resize version
using
ResizeV2
=
opr
::
Resize
;
MGB_SEREG_OPR
(
ResizeV2
,
2
);
using
DctChannelSelectV1
=
opr
::
DctChannelSelect
;
MGB_SEREG_OPR
(
DctChannelSelectV1
,
0
);
}
// namespace opr
}
// namespace mgb
// vim: ft=cpp syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录