提交 0186dee5 编写于 作者: Y Yao,kun

Add marco

上级 11eb4d6f
...@@ -28,8 +28,8 @@ template class DropoutOp<CPU, float>; ...@@ -28,8 +28,8 @@ template class DropoutOp<CPU, float>;
namespace ops = paddle_mobile::operators; namespace ops = paddle_mobile::operators;
#ifdef PADDLE_MOBILE_CPU #ifdef PADDLE_MOBILE_CPU
USE_OP(Dropout); USE_OP_CPU(Dropout);
REGISTER_OPERATOR(dropout, ops::DropoutOp); REGISTER_OPERATOR_CPU(dropout, ops::DropoutOp);
#endif #endif
#ifdef PADDLE_MOBILE_MALI_GPU #ifdef PADDLE_MOBILE_MALI_GPU
#endif #endif
......
...@@ -30,13 +30,14 @@ using paddle_mobile::framework::Tensor; ...@@ -30,13 +30,14 @@ using paddle_mobile::framework::Tensor;
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class DropoutOp class DropoutOp
: public framework::OperatorWithKernel< : public framework::OperatorWithKernel<
DeviceType, DropoutParam, operators::DropoutKernal<DeviceType, T>> { DeviceType, DropoutParam, operators::DropoutKernel<DeviceType, T>> {
public: public:
DropoutOp(const std::string &type, const VariableNameMap &inputs, DropoutOp(const std::string &type, const VariableNameMap &inputs,
const VariableNameMap &outputs, const framework::AttributeMap attrs, const VariableNameMap &outputs, const framework::AttributeMap attrs,
std::shared_ptr<framework::Scope> scope) std::shared_ptr<framework::Scope> scope)
: framework::OperatorWithKernel<DeviceType>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<DeviceType, DropoutParam,
scope), operators::DropoutKernel<DeviceType, T>>(
type, inputs, outputs, attrs, scope),
param_(inputs, outputs, attrs, *scope) {} param_(inputs, outputs, attrs, *scope) {}
using framework::OperatorWithKernel<DeviceType, DropoutParam, using framework::OperatorWithKernel<DeviceType, DropoutParam,
......
...@@ -54,8 +54,8 @@ template class Im2SequenceOp<CPU, float>; ...@@ -54,8 +54,8 @@ template class Im2SequenceOp<CPU, float>;
namespace ops = paddle_mobile::operators; namespace ops = paddle_mobile::operators;
#ifdef PADDLE_MOBILE_CPU #ifdef PADDLE_MOBILE_CPU
USE_OP(im2sequence); USE_OP_CPU(im2sequence);
REGISTER_OPERATOR(im2sequence, ops::Im2SequenceOp); REGISTER_OPERATOR_CPU(im2sequence, ops::Im2SequenceOp);
#endif #endif
#ifdef PADDLE_MOBILE_MALI_GPU #ifdef PADDLE_MOBILE_MALI_GPU
#endif #endif
......
...@@ -28,14 +28,16 @@ using namespace framework; ...@@ -28,14 +28,16 @@ using namespace framework;
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class Im2SequenceOp : public framework::OperatorWithKernel< class Im2SequenceOp : public framework::OperatorWithKernel<
DeviceType, Im2SequenceParam, DeviceType, Im2SequenceParam,
operators::Im2SequenceKernal<DeviceType, T>> { operators::Im2SequenceKernel<DeviceType, T>> {
public: public:
Im2SequenceOp(const std::string &type, const VariableNameMap &inputs, Im2SequenceOp(const std::string &type, const VariableNameMap &inputs,
const VariableNameMap &outputs, const VariableNameMap &outputs,
const framework::AttributeMap &attrs, const framework::AttributeMap &attrs,
std::shared_ptr<framework::Scope> scope) std::shared_ptr<framework::Scope> scope)
: framework::OperatorWithKernel<DeviceType>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<
scope), DeviceType, Im2SequenceParam,
operators::Im2SequenceKernel<DeviceType, T>>(type, inputs, outputs,
attrs, scope),
param_(inputs, outputs, attrs, *scope) {} param_(inputs, outputs, attrs, *scope) {}
using framework::OperatorWithKernel< using framework::OperatorWithKernel<
......
...@@ -12,6 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ...@@ -12,6 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#ifdef DROPOUT_OP
#pragma once #pragma once
#include "operators/kernel/dropout_kernel.h" #include "operators/kernel/dropout_kernel.h"
...@@ -43,3 +45,5 @@ void DropoutKernel<CPU, float>::Compute(const DropoutParam &param) const { ...@@ -43,3 +45,5 @@ void DropoutKernel<CPU, float>::Compute(const DropoutParam &param) const {
} }
} // namespace operators } // namespace operators
} // namespace paddle_mobile } // namespace paddle_mobile
#endif
...@@ -12,6 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ...@@ -12,6 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#ifdef IM2SEQUENCE_OP
#include "operators/kernel/im2sequence_kernel.h" #include "operators/kernel/im2sequence_kernel.h"
namespace paddle_mobile { namespace paddle_mobile {
...@@ -72,3 +74,5 @@ template class Im2SequenceKernel<CPU, float>; ...@@ -72,3 +74,5 @@ template class Im2SequenceKernel<CPU, float>;
} // namespace operators } // namespace operators
} // namespace paddle_mobile } // namespace paddle_mobile
#endif
...@@ -12,6 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ...@@ -12,6 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#ifdef DROPOUT_OP
#include "framework/operator.h" #include "framework/operator.h"
#include "operators/op_param.h" #include "operators/op_param.h"
...@@ -28,3 +30,5 @@ class DropoutKernel : public framework::OpKernelBase<DeviceType, DropoutParam> { ...@@ -28,3 +30,5 @@ class DropoutKernel : public framework::OpKernelBase<DeviceType, DropoutParam> {
}; };
} // namespace operators } // namespace operators
} // namespace paddle_mobile } // namespace paddle_mobile
#endif
...@@ -12,6 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ...@@ -12,6 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#ifdef IM2SEQUENCE_OP
#include "framework/operator.h" #include "framework/operator.h"
#include "operators/math/im2col.h" #include "operators/math/im2col.h"
#include "operators/math/math_function.h" #include "operators/math/math_function.h"
...@@ -34,3 +36,5 @@ class Im2SequenceKernel ...@@ -34,3 +36,5 @@ class Im2SequenceKernel
}; };
} // namespace operators } // namespace operators
} // namespace paddle_mobile } // namespace paddle_mobile
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册