提交 e6302412 编写于 作者: L liuruilong

format files

上级 20d68051
...@@ -109,15 +109,15 @@ class OperatorWithKernel : public OperatorBase<Dtype> { ...@@ -109,15 +109,15 @@ class OperatorWithKernel : public OperatorBase<Dtype> {
OperatorWithKernel(const std::string &type, const VariableNameMap &inputs, OperatorWithKernel(const std::string &type, const VariableNameMap &inputs,
const VariableNameMap &outputs, const AttributeMap &attrs, const VariableNameMap &outputs, const AttributeMap &attrs,
std::shared_ptr<Scope> scope) std::shared_ptr<Scope> scope)
: OperatorBase<Dtype>(type, inputs, outputs, attrs, scope), param_(inputs, outputs, attrs, *scope){ : OperatorBase<Dtype>(type, inputs, outputs, attrs, scope),
param_(inputs, outputs, attrs, *scope) {
kernel_.Init(param_); kernel_.Init(param_);
} }
virtual void RunImpl() const { virtual void RunImpl() const { this->kernel_.Compute(this->param_); }
this->kernel_.Compute(this->param_);
}
virtual void InferShape() const = 0; virtual void InferShape() const = 0;
protected: protected:
KernelType kernel_; KernelType kernel_;
ParamType param_; ParamType param_;
...@@ -135,9 +135,7 @@ class OpKernelBase { ...@@ -135,9 +135,7 @@ class OpKernelBase {
* 所有结构体存在与: paddle-mobile/src/operators/op_param.h * 所有结构体存在与: paddle-mobile/src/operators/op_param.h
* */ * */
virtual void Compute(const P &para) const = 0; virtual void Compute(const P &para) const = 0;
virtual bool Init(const P &para) const { virtual bool Init(const P &para) const { return true; };
return true;
};
virtual ~OpKernelBase() = default; virtual ~OpKernelBase() = default;
}; };
......
...@@ -25,15 +25,17 @@ namespace paddle_mobile { ...@@ -25,15 +25,17 @@ namespace paddle_mobile {
namespace operators { namespace operators {
using std::string; using std::string;
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class BatchNormOp : public framework::OperatorWithKernel<DeviceType, BatchNormParam,BatchNormKernel<DeviceType, T>> { class BatchNormOp
: public framework::OperatorWithKernel<DeviceType, BatchNormParam,
BatchNormKernel<DeviceType, T>> {
public: public:
BatchNormOp(const string &type, const VariableNameMap &inputs, BatchNormOp(const 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, BatchNormParam, BatchNormKernel<DeviceType, T>>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<DeviceType, BatchNormParam,
scope) { BatchNormKernel<DeviceType, T>>(
} type, inputs, outputs, attrs, scope) {}
void InferShape() const override; void InferShape() const override;
......
...@@ -28,16 +28,21 @@ namespace operators { ...@@ -28,16 +28,21 @@ namespace operators {
using paddle_mobile::framework::Tensor; using paddle_mobile::framework::Tensor;
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class BoxCoderOp : public framework::OperatorWithKernel<DeviceType, BoxCoderParam, operators::BoxCoderKernel<DeviceType, T>> { class BoxCoderOp
: public framework::OperatorWithKernel<
DeviceType, BoxCoderParam, operators::BoxCoderKernel<DeviceType, T>> {
public: public:
BoxCoderOp(const std::string &type, const VariableNameMap &inputs, BoxCoderOp(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, BoxCoderParam, operators::BoxCoderKernel<DeviceType, T>>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<DeviceType, BoxCoderParam,
scope) {} operators::BoxCoderKernel<DeviceType, T>>(
type, inputs, outputs, attrs, scope) {}
using framework::OperatorWithKernel<DeviceType, BoxCoderParam, operators::BoxCoderKernel<DeviceType, T>>::OperatorWithKernel; using framework::OperatorWithKernel<
DeviceType, BoxCoderParam,
operators::BoxCoderKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
protected: protected:
......
...@@ -24,17 +24,22 @@ namespace paddle_mobile { ...@@ -24,17 +24,22 @@ namespace paddle_mobile {
namespace operators { namespace operators {
using std::string; using std::string;
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class ConcatOp : public framework::OperatorWithKernel<DeviceType, ConcatParam, operators::ConcatKernel<DeviceType, T>> { class ConcatOp
: public framework::OperatorWithKernel<
DeviceType, ConcatParam, operators::ConcatKernel<DeviceType, T>> {
public: public:
ConcatOp(const string &type, const VariableNameMap &inputs, ConcatOp(const 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, ConcatParam, operators::ConcatKernel<DeviceType, T>>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<DeviceType, ConcatParam,
scope) { operators::ConcatKernel<DeviceType, T>>(
} type, inputs, outputs, attrs, scope) {}
using framework::OperatorWithKernel<DeviceType, ConcatParam, operators::ConcatKernel<DeviceType, T>>::OperatorWithKernel; using framework::OperatorWithKernel<
DeviceType, ConcatParam,
operators::ConcatKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
protected: protected:
}; };
......
...@@ -24,15 +24,20 @@ namespace paddle_mobile { ...@@ -24,15 +24,20 @@ namespace paddle_mobile {
namespace operators { namespace operators {
using std::string; using std::string;
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class ConvOp : public framework::OperatorWithKernel<DeviceType, ConvParam, operators::ConvKernel<DeviceType, T>> { class ConvOp
: public framework::OperatorWithKernel<
DeviceType, ConvParam, operators::ConvKernel<DeviceType, T>> {
public: public:
ConvOp(const std::string &type, const VariableNameMap &inputs, ConvOp(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, ConvParam, operators::ConvKernel<DeviceType, T>>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<DeviceType, ConvParam,
scope){} operators::ConvKernel<DeviceType, T>>(
type, inputs, outputs, attrs, scope) {}
using framework::OperatorWithKernel<DeviceType, ConvParam, operators::ConvKernel<DeviceType, T>>::OperatorWithKernel; using framework::OperatorWithKernel<
DeviceType, ConvParam,
operators::ConvKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
private: private:
......
...@@ -24,16 +24,22 @@ namespace paddle_mobile { ...@@ -24,16 +24,22 @@ namespace paddle_mobile {
namespace operators { namespace operators {
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class DepthwiseConvOp : public framework::OperatorWithKernel<DeviceType, ConvParam, operators::DepthwiseConvKernel<DeviceType, T>> { class DepthwiseConvOp : public framework::OperatorWithKernel<
DeviceType, ConvParam,
operators::DepthwiseConvKernel<DeviceType, T>> {
public: public:
DepthwiseConvOp(const std::string &type, const VariableNameMap &inputs, DepthwiseConvOp(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, ConvParam, operators::DepthwiseConvKernel<DeviceType, T>>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<
scope) {} DeviceType, ConvParam,
operators::DepthwiseConvKernel<DeviceType, T>>(
using framework::OperatorWithKernel<DeviceType, ConvParam, operators::DepthwiseConvKernel<DeviceType, T>>::OperatorWithKernel; type, inputs, outputs, attrs, scope) {}
using framework::OperatorWithKernel<
DeviceType, ConvParam,
operators::DepthwiseConvKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
private: private:
......
...@@ -25,16 +25,22 @@ namespace paddle_mobile { ...@@ -25,16 +25,22 @@ namespace paddle_mobile {
namespace operators { namespace operators {
using std::string; using std::string;
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class ElementwiseAddOp : public framework::OperatorWithKernel<DeviceType, ElementwiseAddParam, operators::ElementwiseAddKernel<DeviceType, T>> { class ElementwiseAddOp : public framework::OperatorWithKernel<
DeviceType, ElementwiseAddParam,
operators::ElementwiseAddKernel<DeviceType, T>> {
public: public:
ElementwiseAddOp(const string &type, const VariableNameMap &inputs, ElementwiseAddOp(const 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, ElementwiseAddParam, operators::ElementwiseAddKernel<DeviceType, T>>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<
scope) {} DeviceType, ElementwiseAddParam,
operators::ElementwiseAddKernel<DeviceType, T>>(
using framework::OperatorWithKernel<DeviceType, ElementwiseAddParam, operators::ElementwiseAddKernel<DeviceType, T>>::OperatorWithKernel; type, inputs, outputs, attrs, scope) {}
using framework::OperatorWithKernel<
DeviceType, ElementwiseAddParam,
operators::ElementwiseAddKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
protected: protected:
......
...@@ -47,16 +47,21 @@ class FusionConvAddMatcher : public framework::FusionOpMatcher { ...@@ -47,16 +47,21 @@ class FusionConvAddMatcher : public framework::FusionOpMatcher {
}; };
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class FushionConvAddOp : public framework::OperatorWithKernel<DeviceType, FushionConvAddParam, operators::ConvAddKernel<DeviceType, T>> { class FushionConvAddOp : public framework::OperatorWithKernel<
DeviceType, FushionConvAddParam,
operators::ConvAddKernel<DeviceType, T>> {
public: public:
FushionConvAddOp(const string &type, const VariableNameMap &inputs, FushionConvAddOp(const 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, FushionConvAddParam, operators::ConvAddKernel<DeviceType, T>>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<DeviceType, FushionConvAddParam,
scope) {} operators::ConvAddKernel<DeviceType, T>>(
type, inputs, outputs, attrs, scope) {}
using framework::OperatorWithKernel<DeviceType, FushionConvAddParam, operators::ConvAddKernel<DeviceType, T>>::OperatorWithKernel; using framework::OperatorWithKernel<
DeviceType, FushionConvAddParam,
operators::ConvAddKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
protected: protected:
......
...@@ -45,16 +45,22 @@ class FusionFcMatcher : public framework::FusionOpMatcher { ...@@ -45,16 +45,22 @@ class FusionFcMatcher : public framework::FusionOpMatcher {
}; };
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class FushionFcOp : public framework::OperatorWithKernel<DeviceType, FushionFcParam, operators::FushionFcKernel<DeviceType, T>> { class FushionFcOp : public framework::OperatorWithKernel<
DeviceType, FushionFcParam,
operators::FushionFcKernel<DeviceType, T>> {
public: public:
FushionFcOp(const string &type, const VariableNameMap &inputs, FushionFcOp(const 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, FushionFcParam, operators::FushionFcKernel<DeviceType, T>>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<
scope) {} DeviceType, FushionFcParam,
operators::FushionFcKernel<DeviceType, T>>(type, inputs, outputs,
using framework::OperatorWithKernel<DeviceType, FushionFcParam, operators::FushionFcKernel<DeviceType, T>>::OperatorWithKernel; attrs, scope) {}
using framework::OperatorWithKernel<
DeviceType, FushionFcParam,
operators::FushionFcKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
protected: protected:
......
...@@ -61,7 +61,7 @@ void BatchNormKernel<CPU, float>::Compute(const BatchNormParam &param) const { ...@@ -61,7 +61,7 @@ void BatchNormKernel<CPU, float>::Compute(const BatchNormParam &param) const {
/// std = (var + epsilon).sqrt(); /// std = (var + epsilon).sqrt();
/// inv_std = 1 / std; /// inv_std = 1 / std;
for (int i = 0; i < C * 4; i += 4) { for (int i = 0; i < C * 4; i += 4) {
int index = i/4; int index = i / 4;
inv_std_ptr[i] = inv_std_ptr[i] =
1 / static_cast<float>(pow((variance_ptr[index] + epsilon), 0.5)); 1 / static_cast<float>(pow((variance_ptr[index] + epsilon), 0.5));
inv_std_ptr[i + 1] = inv_std_ptr[i]; inv_std_ptr[i + 1] = inv_std_ptr[i];
......
...@@ -21,8 +21,8 @@ namespace operators { ...@@ -21,8 +21,8 @@ namespace operators {
template <> template <>
void ConvKernel<GPU_MALI, float>::Compute(const ConvParam &param) const { void ConvKernel<GPU_MALI, float>::Compute(const ConvParam &param) const {
// ArmConvImplement imp; // ArmConvImplement imp;
// imp.Compute(param); // imp.Compute(param);
} }
template class ConvKernel<GPU_MALI, float>; template class ConvKernel<GPU_MALI, float>;
......
...@@ -25,16 +25,21 @@ namespace paddle_mobile { ...@@ -25,16 +25,21 @@ namespace paddle_mobile {
namespace operators { namespace operators {
using std::string; using std::string;
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class LrnOp : public framework::OperatorWithKernel<DeviceType, LrnParam, operators::LrnKernel<DeviceType, T>> { class LrnOp : public framework::OperatorWithKernel<
DeviceType, LrnParam, operators::LrnKernel<DeviceType, T>> {
public: public:
LrnOp(const string &type, const VariableNameMap &inputs, LrnOp(const 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, LrnParam, operators::LrnKernel<DeviceType, T>>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<DeviceType, LrnParam,
scope) {} operators::LrnKernel<DeviceType, T>>(
type, inputs, outputs, attrs, scope) {}
using framework::OperatorWithKernel<DeviceType, LrnParam, operators::LrnKernel<DeviceType, T>>::OperatorWithKernel; using framework::OperatorWithKernel<
DeviceType, LrnParam,
operators::LrnKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
protected: protected:
}; };
......
...@@ -25,15 +25,19 @@ namespace paddle_mobile { ...@@ -25,15 +25,19 @@ namespace paddle_mobile {
namespace operators { namespace operators {
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class MulOp : public framework::OperatorWithKernel<DeviceType, MulParam, operators::MulKernel<DeviceType, T>> { class MulOp : public framework::OperatorWithKernel<
DeviceType, MulParam, operators::MulKernel<DeviceType, T>> {
public: public:
MulOp(const std::string &type, const VariableNameMap &inputs, MulOp(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, MulParam, operators::MulKernel<DeviceType, T>>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<DeviceType, MulParam,
scope) {} operators::MulKernel<DeviceType, T>>(
type, inputs, outputs, attrs, scope) {}
using framework::OperatorWithKernel<DeviceType, MulParam, operators::MulKernel<DeviceType, T>>::OperatorWithKernel; using framework::OperatorWithKernel<
DeviceType, MulParam,
operators::MulKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
protected: protected:
......
...@@ -28,16 +28,22 @@ namespace operators { ...@@ -28,16 +28,22 @@ namespace operators {
using paddle_mobile::framework::Tensor; using paddle_mobile::framework::Tensor;
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class MultiClassNMSOp : public framework::OperatorWithKernel<DeviceType, MultiClassNMSParam, operators::MultiClassNMSKernel<DeviceType, T>> { class MultiClassNMSOp : public framework::OperatorWithKernel<
DeviceType, MultiClassNMSParam,
operators::MultiClassNMSKernel<DeviceType, T>> {
public: public:
MultiClassNMSOp(const std::string &type, const VariableNameMap &inputs, MultiClassNMSOp(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, MultiClassNMSParam, operators::MultiClassNMSKernel<DeviceType, T>>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<
scope) {} DeviceType, MultiClassNMSParam,
operators::MultiClassNMSKernel<DeviceType, T>>(
using framework::OperatorWithKernel<DeviceType, MultiClassNMSParam, operators::MultiClassNMSKernel<DeviceType, T>>::OperatorWithKernel; type, inputs, outputs, attrs, scope) {}
using framework::OperatorWithKernel<
DeviceType, MultiClassNMSParam,
operators::MultiClassNMSKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
protected: protected:
......
...@@ -29,13 +29,18 @@ using framework::OperatorWithKernel; ...@@ -29,13 +29,18 @@ using framework::OperatorWithKernel;
using framework::Scope; using framework::Scope;
using std::string; using std::string;
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class PoolOp : public OperatorWithKernel<DeviceType, PoolParam, operators::PoolKernel<DeviceType, T>> { class PoolOp : public OperatorWithKernel<DeviceType, PoolParam,
operators::PoolKernel<DeviceType, T>> {
public: public:
PoolOp(const string &type, const VariableNameMap &inputs, PoolOp(const string &type, const VariableNameMap &inputs,
const VariableNameMap &outputs, const AttributeMap &attrs, const VariableNameMap &outputs, const AttributeMap &attrs,
std::shared_ptr<Scope> scope) std::shared_ptr<Scope> scope)
: OperatorWithKernel<DeviceType, PoolParam, operators::PoolKernel<DeviceType, T>>(type, inputs, outputs, attrs, scope) {} : OperatorWithKernel<DeviceType, PoolParam,
using OperatorWithKernel<DeviceType, PoolParam, operators::PoolKernel<DeviceType, T>>::OperatorWithKernel; operators::PoolKernel<DeviceType, T>>(
type, inputs, outputs, attrs, scope) {}
using OperatorWithKernel<
DeviceType, PoolParam,
operators::PoolKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
private: private:
......
...@@ -28,16 +28,21 @@ namespace operators { ...@@ -28,16 +28,21 @@ namespace operators {
using paddle_mobile::framework::Tensor; using paddle_mobile::framework::Tensor;
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class PriorBoxOp : public framework::OperatorWithKernel<DeviceType, PriorBoxParam, operators::PriorBoxKernel<DeviceType, T>> { class PriorBoxOp
: public framework::OperatorWithKernel<
DeviceType, PriorBoxParam, operators::PriorBoxKernel<DeviceType, T>> {
public: public:
PriorBoxOp(const std::string &type, const VariableNameMap &inputs, PriorBoxOp(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, PriorBoxParam, operators::PriorBoxKernel<DeviceType, T>>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<DeviceType, PriorBoxParam,
scope) {} operators::PriorBoxKernel<DeviceType, T>>(
type, inputs, outputs, attrs, scope) {}
using framework::OperatorWithKernel<DeviceType, PriorBoxParam, operators::PriorBoxKernel<DeviceType, T>>::OperatorWithKernel; using framework::OperatorWithKernel<
DeviceType, PriorBoxParam,
operators::PriorBoxKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
protected: protected:
......
...@@ -28,7 +28,9 @@ namespace operators { ...@@ -28,7 +28,9 @@ namespace operators {
using paddle_mobile::framework::Tensor; using paddle_mobile::framework::Tensor;
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class ReluOp : public framework::OperatorWithKernel<DeviceType, ReluParam, operators::ReluKernel<DeviceType, T>> { class ReluOp
: public framework::OperatorWithKernel<
DeviceType, ReluParam, operators::ReluKernel<DeviceType, T>> {
public: public:
/* /*
* @b op 的实例化方法, 需要调用父类的实例化方法, 以及实例化自己的参数结构体 * @b op 的实例化方法, 需要调用父类的实例化方法, 以及实例化自己的参数结构体
...@@ -36,10 +38,13 @@ class ReluOp : public framework::OperatorWithKernel<DeviceType, ReluParam, opera ...@@ -36,10 +38,13 @@ class ReluOp : public framework::OperatorWithKernel<DeviceType, ReluParam, opera
ReluOp(const std::string &type, const VariableNameMap &inputs, ReluOp(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, ReluParam, operators::ReluKernel<DeviceType, T>>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<DeviceType, ReluParam,
scope) {} operators::ReluKernel<DeviceType, T>>(
type, inputs, outputs, attrs, scope) {}
using framework::OperatorWithKernel<DeviceType, ReluParam, operators::ReluKernel<DeviceType, T>>::OperatorWithKernel; using framework::OperatorWithKernel<
DeviceType, ReluParam,
operators::ReluKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
protected: protected:
......
...@@ -28,16 +28,21 @@ namespace operators { ...@@ -28,16 +28,21 @@ namespace operators {
using paddle_mobile::framework::Tensor; using paddle_mobile::framework::Tensor;
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class ReshapeOp : public framework::OperatorWithKernel<DeviceType, ReshapeParam, operators::ReshapeKernel<DeviceType, T>> { class ReshapeOp
: public framework::OperatorWithKernel<
DeviceType, ReshapeParam, operators::ReshapeKernel<DeviceType, T>> {
public: public:
ReshapeOp(const std::string &type, const VariableNameMap &inputs, ReshapeOp(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, ReshapeParam, operators::ReshapeKernel<DeviceType, T>>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<DeviceType, ReshapeParam,
scope) {} operators::ReshapeKernel<DeviceType, T>>(
type, inputs, outputs, attrs, scope) {}
using framework::OperatorWithKernel<DeviceType, ReshapeParam, operators::ReshapeKernel<DeviceType, T>>::OperatorWithKernel; using framework::OperatorWithKernel<
DeviceType, ReshapeParam,
operators::ReshapeKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
protected: protected:
......
...@@ -25,16 +25,21 @@ limitations under the License. */ ...@@ -25,16 +25,21 @@ limitations under the License. */
namespace paddle_mobile { namespace paddle_mobile {
namespace operators { namespace operators {
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class SigmoidOp : public framework::OperatorWithKernel<DeviceType, SigmoidParam, operators::SigmoidKernel<DeviceType, T>> { class SigmoidOp
: public framework::OperatorWithKernel<
DeviceType, SigmoidParam, operators::SigmoidKernel<DeviceType, T>> {
public: public:
SigmoidOp(const std::string &type, const VariableNameMap &inputs, SigmoidOp(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, SigmoidParam, operators::SigmoidKernel<DeviceType, T>>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<DeviceType, SigmoidParam,
scope) {} operators::SigmoidKernel<DeviceType, T>>(
type, inputs, outputs, attrs, scope) {}
using framework::OperatorWithKernel<DeviceType, SigmoidParam, operators::SigmoidKernel<DeviceType, T>>::OperatorWithKernel; using framework::OperatorWithKernel<
DeviceType, SigmoidParam,
operators::SigmoidKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
}; };
......
...@@ -25,16 +25,21 @@ limitations under the License. */ ...@@ -25,16 +25,21 @@ limitations under the License. */
namespace paddle_mobile { namespace paddle_mobile {
namespace operators { namespace operators {
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class SoftmaxOp : public framework::OperatorWithKernel<DeviceType, SoftmaxParam, operators::SoftmaxKernel<DeviceType, T>> { class SoftmaxOp
: public framework::OperatorWithKernel<
DeviceType, SoftmaxParam, operators::SoftmaxKernel<DeviceType, T>> {
public: public:
SoftmaxOp(const std::string &type, const VariableNameMap &inputs, SoftmaxOp(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, SoftmaxParam, operators::SoftmaxKernel<DeviceType, T>>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<DeviceType, SoftmaxParam,
scope) {} operators::SoftmaxKernel<DeviceType, T>>(
type, inputs, outputs, attrs, scope) {}
using framework::OperatorWithKernel<DeviceType, SoftmaxParam, operators::SoftmaxKernel<DeviceType, T>>::OperatorWithKernel; using framework::OperatorWithKernel<
DeviceType, SoftmaxParam,
operators::SoftmaxKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
......
...@@ -28,16 +28,22 @@ namespace operators { ...@@ -28,16 +28,22 @@ namespace operators {
using paddle_mobile::framework::Tensor; using paddle_mobile::framework::Tensor;
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class TransposeOp : public framework::OperatorWithKernel<DeviceType, TransposeParam, operators::TransposeKernel<DeviceType, T>> { class TransposeOp : public framework::OperatorWithKernel<
DeviceType, TransposeParam,
operators::TransposeKernel<DeviceType, T>> {
public: public:
TransposeOp(const std::string &type, const VariableNameMap &inputs, TransposeOp(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, TransposeParam, operators::TransposeKernel<DeviceType, T>>(type, inputs, outputs, attrs, : framework::OperatorWithKernel<
scope) {} DeviceType, TransposeParam,
operators::TransposeKernel<DeviceType, T>>(type, inputs, outputs,
using framework::OperatorWithKernel<DeviceType, TransposeParam, operators::TransposeKernel<DeviceType, T>>::OperatorWithKernel; attrs, scope) {}
using framework::OperatorWithKernel<
DeviceType, TransposeParam,
operators::TransposeKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册