From 1f713f6822b96ccaff5684e547dac32590047d85 Mon Sep 17 00:00:00 2001 From: Yi Wang Date: Sat, 2 Sep 2017 17:25:05 -0700 Subject: [PATCH] in response to comments from Jia-Yi --- doc/design/layers_operators.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/design/layers_operators.md b/doc/design/layers_operators.md index 131effbccff..e4f8d303e8b 100644 --- a/doc/design/layers_operators.md +++ b/doc/design/layers_operators.md @@ -1,4 +1,4 @@ -# Design Doc: Layers and Operators +# Design Doc: Functions, Operators, and Layers In a DL system, we can compose one or more fine grained operators into a coarse grained one. For example, the FC layer can be composed of a multiplication operator and an add operator. @@ -20,8 +20,8 @@ Then we can wrap them into operators which are C++ classes and can be created fr generates ```c++ -class mulOp : public OperatorBase {...}; -REGISTER_OP(mulOp, "mul"); +template class mulOp : public OperatorBase {...}; +REGISTER_OP(mulOp, "mul"); ``` so that in Python we can create operator mul by: @@ -36,12 +36,13 @@ paddle.cpp.create_operator("mul", input=[X1, X2], output=Y) Also, at the same time, we can compose a coarse level C++ operator class by composing functions `mul` and `add`: ```c++ +template class FCOp : public OperatorBase { public: void Run(...) { - add(mul(Input("X"), Input("W")), Input("b"); + add(mul(Input("X"), Input("W")), Input("b"); } -}; +};d REGISTER_OP(FCOp, "fc"); ``` -- GitLab