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

fix codestyle

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