Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
6d1403ca
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6d1403ca
编写于
9月 04, 2017
作者:
T
Travis CI
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Deploy to GitHub Pages:
94f75624
上级
80ed482e
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
5 addition
and
5 deletion
+5
-5
develop/doc_cn/_sources/howto/dev/new_op_cn.md.txt
develop/doc_cn/_sources/howto/dev/new_op_cn.md.txt
+2
-2
develop/doc_cn/howto/dev/new_op_cn.html
develop/doc_cn/howto/dev/new_op_cn.html
+2
-2
develop/doc_cn/searchindex.js
develop/doc_cn/searchindex.js
+1
-1
未找到文件。
develop/doc_cn/_sources/howto/dev/new_op_cn.md.txt
浏览文件 @
6d1403ca
...
...
@@ -178,13 +178,13 @@ class MulKernel : public framework::OpKernel {
```c++
namespace ops = paddle::operators;
REGISTER_OP(mul, ops::MulOp, ops::MulOpMaker, ops::MulOpGrad);
REGISTER_OP(mul, ops::MulOp, ops::MulOpMaker,
mul_grad,
ops::MulOpGrad);
REGISTER_OP_CPU_KERNEL(mul, ops::MulKernel<paddle::platform::CPUPlace, float>);
REGISTER_OP_CPU_KERNEL(mul_grad,
ops::MulGradKernel<paddle::platform::CPUPlace, float>);
```
- `REGISTER_OP` : 注册`ops::MulOp`类,类型名为`mul`,该类的`ProtoMaker`为`ops::MulOpMaker`,
并且注册`ops::MulOpGrad`为其反向Op。
- `REGISTER_OP` : 注册`ops::MulOp`类,类型名为`mul`,该类的`ProtoMaker`为`ops::MulOpMaker`,
注册`ops::MulOpGrad`,类型名为`mul_grad`,
- `REGISTER_OP_WITHOUT_GRADIENT` : 用于注册没有反向的Op。
- `REGISTER_OP_CPU_KERNEL` :注册`ops::MulKernel`类,并特化模板参数为`paddle::platform::CPUPlace`和`float`类型,同理,注册`ops::MulKernel`类。
...
...
develop/doc_cn/howto/dev/new_op_cn.html
浏览文件 @
6d1403ca
...
...
@@ -341,14 +341,14 @@ Kernel实现 | CPU、GPU共享Kernel在<code class="docutils literal"><spa
<span
id=
"id3"
></span><h3>
4. 注册Operator
<a
class=
"headerlink"
href=
"#operator"
title=
"永久链接至标题"
>
¶
</a></h3>
<p>
在
<code
class=
"docutils literal"
><span
class=
"pre"
>
.cc
</span></code>
文件中注册前向、反向Op类,注册CPU Kernel。
</p>
<div
class=
"highlight-c++"
><div
class=
"highlight"
><pre><span></span><span
class=
"k"
>
namespace
</span>
<span
class=
"n"
>
ops
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
paddle
</span><span
class=
"o"
>
::
</span><span
class=
"n"
>
operators
</span><span
class=
"p"
>
;
</span>
<span
class=
"n"
>
REGISTER_OP
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
mul
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
ops
</span><span
class=
"o"
>
::
</span><span
class=
"n"
>
MulOp
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
ops
</span><span
class=
"o"
>
::
</span><span
class=
"n"
>
MulOpMaker
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
ops
</span><span
class=
"o"
>
::
</span><span
class=
"n"
>
MulOpGrad
</span><span
class=
"p"
>
);
</span>
<span
class=
"n"
>
REGISTER_OP
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
mul
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
ops
</span><span
class=
"o"
>
::
</span><span
class=
"n"
>
MulOp
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
ops
</span><span
class=
"o"
>
::
</span><span
class=
"n"
>
MulOpMaker
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
mul_grad
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
ops
</span><span
class=
"o"
>
::
</span><span
class=
"n"
>
MulOpGrad
</span><span
class=
"p"
>
);
</span>
<span
class=
"n"
>
REGISTER_OP_CPU_KERNEL
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
mul
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
ops
</span><span
class=
"o"
>
::
</span><span
class=
"n"
>
MulKernel
</span><span
class=
"o"
>
<
</span><span
class=
"n"
>
paddle
</span><span
class=
"o"
>
::
</span><span
class=
"n"
>
platform
</span><span
class=
"o"
>
::
</span><span
class=
"n"
>
CPUPlace
</span><span
class=
"p"
>
,
</span>
<span
class=
"kt"
>
float
</span><span
class=
"o"
>
>
</span><span
class=
"p"
>
);
</span>
<span
class=
"n"
>
REGISTER_OP_CPU_KERNEL
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
mul_grad
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
ops
</span><span
class=
"o"
>
::
</span><span
class=
"n"
>
MulGradKernel
</span><span
class=
"o"
>
<
</span><span
class=
"n"
>
paddle
</span><span
class=
"o"
>
::
</span><span
class=
"n"
>
platform
</span><span
class=
"o"
>
::
</span><span
class=
"n"
>
CPUPlace
</span><span
class=
"p"
>
,
</span>
<span
class=
"kt"
>
float
</span><span
class=
"o"
>
>
</span><span
class=
"p"
>
);
</span>
</pre></div>
</div>
<ul
class=
"simple"
>
<li><code
class=
"docutils literal"
><span
class=
"pre"
>
REGISTER_OP
</span></code>
: 注册
<code
class=
"docutils literal"
><span
class=
"pre"
>
ops::MulOp
</span></code>
类,类型名为
<code
class=
"docutils literal"
><span
class=
"pre"
>
mul
</span></code>
,该类的
<code
class=
"docutils literal"
><span
class=
"pre"
>
ProtoMaker
</span></code>
为
<code
class=
"docutils literal"
><span
class=
"pre"
>
ops::MulOpMaker
</span></code>
,
并且注册
<code
class=
"docutils literal"
><span
class=
"pre"
>
ops::MulOpGrad
</span></code>
为其反向Op。
</li>
<li><code
class=
"docutils literal"
><span
class=
"pre"
>
REGISTER_OP
</span></code>
: 注册
<code
class=
"docutils literal"
><span
class=
"pre"
>
ops::MulOp
</span></code>
类,类型名为
<code
class=
"docutils literal"
><span
class=
"pre"
>
mul
</span></code>
,该类的
<code
class=
"docutils literal"
><span
class=
"pre"
>
ProtoMaker
</span></code>
为
<code
class=
"docutils literal"
><span
class=
"pre"
>
ops::MulOpMaker
</span></code>
,
注册
<code
class=
"docutils literal"
><span
class=
"pre"
>
ops::MulOpGrad
</span></code>
,类型名为
<code
class=
"docutils literal"
><span
class=
"pre"
>
mul_grad
</span></code>
,
</li>
<li><code
class=
"docutils literal"
><span
class=
"pre"
>
REGISTER_OP_WITHOUT_GRADIENT
</span></code>
: 用于注册没有反向的Op。
</li>
<li><code
class=
"docutils literal"
><span
class=
"pre"
>
REGISTER_OP_CPU_KERNEL
</span></code>
:注册
<code
class=
"docutils literal"
><span
class=
"pre"
>
ops::MulKernel
</span></code>
类,并特化模板参数为
<code
class=
"docutils literal"
><span
class=
"pre"
>
paddle::platform::CPUPlace
</span></code>
和
<code
class=
"docutils literal"
><span
class=
"pre"
>
float
</span></code>
类型,同理,注册
<code
class=
"docutils literal"
><span
class=
"pre"
>
ops::MulKernel
</span></code>
类。
</li>
</ul>
...
...
develop/doc_cn/searchindex.js
浏览文件 @
6d1403ca
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录