提交 11eb4d6f 编写于 作者: Y Yao,kun

fix codestyle

上级 733fc7ef
...@@ -28,8 +28,9 @@ namespace operators { ...@@ -28,8 +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 DropoutOp : public framework::OperatorWithKernel<DeviceType, DropoutParam, class DropoutOp
operators::DropoutKernal<DeviceType, T>> { : public framework::OperatorWithKernel<
DeviceType, DropoutParam, operators::DropoutKernal<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,
...@@ -39,7 +40,7 @@ class DropoutOp : public framework::OperatorWithKernel<DeviceType, DropoutParam, ...@@ -39,7 +40,7 @@ class DropoutOp : public framework::OperatorWithKernel<DeviceType, DropoutParam,
param_(inputs, outputs, attrs, *scope) {} param_(inputs, outputs, attrs, *scope) {}
using framework::OperatorWithKernel<DeviceType, DropoutParam, using framework::OperatorWithKernel<DeviceType, DropoutParam,
operators::DropoutKernel<DeviceType, T>>; operators::DropoutKernel<DeviceType, T>>;
void InferShape() const override; void InferShape() const override;
protected: protected:
...@@ -49,4 +50,3 @@ class DropoutOp : public framework::OperatorWithKernel<DeviceType, DropoutParam, ...@@ -49,4 +50,3 @@ class DropoutOp : public framework::OperatorWithKernel<DeviceType, DropoutParam,
} // namespace paddle_mobile } // namespace paddle_mobile
#endif #endif
...@@ -26,8 +26,9 @@ namespace operators { ...@@ -26,8 +26,9 @@ namespace operators {
using namespace framework; using namespace framework;
template <typename DeviceType, typename T> template <typename DeviceType, typename T>
class Im2SequenceOp : public framework::OperatorWithKernel<DeviceType, Im2SequenceParam, class Im2SequenceOp : public framework::OperatorWithKernel<
operators::Im2SequenceKernal<DeviceType, T>> { DeviceType, Im2SequenceParam,
operators::Im2SequenceKernal<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,
...@@ -37,8 +38,9 @@ class Im2SequenceOp : public framework::OperatorWithKernel<DeviceType, Im2Sequen ...@@ -37,8 +38,9 @@ class Im2SequenceOp : public framework::OperatorWithKernel<DeviceType, Im2Sequen
scope), scope),
param_(inputs, outputs, attrs, *scope) {} param_(inputs, outputs, attrs, *scope) {}
using framework::OperatorWithKernel<DeviceType, Im2SequenceParam, using framework::OperatorWithKernel<
operators::Im2SequenceKernel<DeviceType, T>>::OperatorWithKernel; DeviceType, Im2SequenceParam,
operators::Im2SequenceKernel<DeviceType, T>>::OperatorWithKernel;
void InferShape() const override; void InferShape() const override;
private: private:
......
...@@ -22,9 +22,9 @@ namespace operators { ...@@ -22,9 +22,9 @@ namespace operators {
template <> template <>
bool DropoutKernel<CPU, float>::Init(const DropoutParam &para) const { bool DropoutKernel<CPU, float>::Init(const DropoutParam &para) const {
return true; return true;
} }
template <typename T> template <typename T>
struct DropoutFunctor { struct DropoutFunctor {
inline T operator()(T in) const { return in; } inline T operator()(T in) const { return in; }
......
...@@ -21,7 +21,7 @@ template <> ...@@ -21,7 +21,7 @@ template <>
bool Im2SequenceKernel<CPU, float>::Init(const Im2SequenceParam &para) const { bool Im2SequenceKernel<CPU, float>::Init(const Im2SequenceParam &para) const {
return true; return true;
} }
inline int Im2SeqOutputSize(int input_size, int filter_size, int padding_0, inline int Im2SeqOutputSize(int input_size, int filter_size, int padding_0,
int padding_1, int stride) { int padding_1, int stride) {
const int output_size = const int output_size =
......
...@@ -24,7 +24,7 @@ template <typename DeviceType, typename T> ...@@ -24,7 +24,7 @@ template <typename DeviceType, typename T>
class DropoutKernel : public framework::OpKernelBase<DeviceType, DropoutParam> { class DropoutKernel : public framework::OpKernelBase<DeviceType, DropoutParam> {
public: public:
void Compute(const DropoutParam& param) const; void Compute(const DropoutParam& param) const;
bool Init(const DropoutParam &para) const; bool Init(const DropoutParam& para) const;
}; };
} // namespace operators } // namespace operators
} // namespace paddle_mobile } // namespace paddle_mobile
...@@ -934,57 +934,57 @@ class FusionConvAddBNReluParam : public OpParam { ...@@ -934,57 +934,57 @@ class FusionConvAddBNReluParam : public OpParam {
Print &operator<<(Print &printer, const FusionConvAddParam &conv_param); Print &operator<<(Print &printer, const FusionConvAddParam &conv_param);
#endif #endif
#ifdef IM2SEQUENCE_OP #ifdef IM2SEQUENCE_OP
class Im2SequenceParam : public OpParam { class Im2SequenceParam : public OpParam {
public: public:
Im2SequenceParam(const VariableNameMap &inputs, Im2SequenceParam(const VariableNameMap &inputs,
const VariableNameMap &outputs, const AttributeMap &attrs, const VariableNameMap &outputs, const AttributeMap &attrs,
const Scope &scope) { const Scope &scope) {
input_x_ = InputXFrom<LoDTensor>(inputs, scope); input_x_ = InputXFrom<LoDTensor>(inputs, scope);
out_ = OutFrom<LoDTensor>(outputs, scope); out_ = OutFrom<LoDTensor>(outputs, scope);
kernels_ = GetAttr<vector<int>>("kernels", attrs); kernels_ = GetAttr<vector<int>>("kernels", attrs);
strides_ = GetAttr<vector<int>>("strides", attrs); strides_ = GetAttr<vector<int>>("strides", attrs);
paddings_ = GetAttr<vector<int>>("paddings", attrs); paddings_ = GetAttr<vector<int>>("paddings", attrs);
} }
const Tensor *Input() const { return input_x_; } const Tensor *Input() const { return input_x_; }
Tensor *Output() const { return out_; } Tensor *Output() const { return out_; }
const vector<int> &Kernels() const { return kernels_; } const vector<int> &Kernels() const { return kernels_; }
const vector<int> &Strides() const { return strides_; } const vector<int> &Strides() const { return strides_; }
const vector<int> &Paddings() const { return paddings_; } const vector<int> &Paddings() const { return paddings_; }
private: private:
Tensor *input_x_; Tensor *input_x_;
Tensor *out_; Tensor *out_;
vector<int> kernels_; vector<int> kernels_;
vector<int> strides_; vector<int> strides_;
vector<int> paddings_; vector<int> paddings_;
}; };
#endif #endif
#ifdef DROPOUT_OP #ifdef DROPOUT_OP
class DropoutParam : public OpParam { class DropoutParam : public OpParam {
public: public:
DropoutParam(const VariableNameMap &inputs, const VariableNameMap &outputs, DropoutParam(const VariableNameMap &inputs, const VariableNameMap &outputs,
const AttributeMap &attrs, const Scope &scope) { const AttributeMap &attrs, const Scope &scope) {
input_x_ = InputXFrom<LoDTensor>(inputs, scope); input_x_ = InputXFrom<LoDTensor>(inputs, scope);
out_ = OutFrom<LoDTensor>(outputs, scope); out_ = OutFrom<LoDTensor>(outputs, scope);
} }
const Tensor *InputX() const { return input_x_; } const Tensor *InputX() const { return input_x_; }
Tensor *Out() const { return out_; } Tensor *Out() const { return out_; }
private: private:
Tensor *input_x_; Tensor *input_x_;
Tensor *out_; Tensor *out_;
}; };
#endif #endif
} // namespace operators } // namespace operators
} // namespace paddle_mobile } // namespace paddle_mobile
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册