提交 df8ad667 编写于 作者: W wangliu

modify code style

上级 5a152298
......@@ -22,8 +22,8 @@ SOFTWARE.
namespace paddle_mobile {
namespace framework {
template <typename Dtype>
OperatorBase<Dtype>::OperatorBase(const std::string &type,
template <typename Dtype>
OperatorBase<Dtype>::OperatorBase(const std::string &type,
const VariableNameMap &inputs,
const VariableNameMap &outputs,
const AttributeMap &attrs,
......@@ -31,12 +31,12 @@ OperatorBase<Dtype>::OperatorBase(const std::string &type,
: type_(type), inputs_(inputs), outputs_(outputs), attrs_(attrs),
scope_(scope) {
CheckAllInputOutputSet();
}
template <typename Dtype>
void OperatorBase<Dtype>::CheckAllInputOutputSet() const {}
}
template <typename Dtype>
void OperatorBase<Dtype>::CheckAllInputOutputSet() const {}
template class OperatorBase<CPU>;
template class OperatorWithKernel<CPU>;
template class OperatorBase<CPU>;
template class OperatorWithKernel<CPU>;
} // namespace framework
} // namespace paddle_mobile
......@@ -22,18 +22,19 @@ SOFTWARE.
#include "operators/kernel/pool_kernel.h"
namespace paddle_mobile {
namespace operators {
namespace operators {
using namespace framework;
using namespace framework;
template <typename DeviceType, typename T>
class ConvOp : public framework::OperatorWithKernel<DeviceType> {
public:
template <typename DeviceType, typename T>
class ConvOp : public framework::OperatorWithKernel<DeviceType> {
public:
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)
: framework::OperatorWithKernel<DeviceType>(type, inputs, outputs, attrs,
scope),
: framework::OperatorWithKernel<DeviceType>(
type, inputs, outputs, attrs, scope),
param_(inputs, outputs, attrs, *scope) {}
using framework::OperatorWithKernel<DeviceType>::OperatorWithKernel;
......@@ -45,9 +46,9 @@ public:
this->ClearVariables();
}
private:
private:
ConvParam param_;
};
};
} // operators
} // operators
} // paddle_mobile
......@@ -26,9 +26,9 @@ SOFTWARE.
#include <typeinfo>
namespace paddle_mobile {
namespace framework {
class Variable : public PaddleMobileObject {
public:
namespace framework {
class Variable : public PaddleMobileObject {
public:
template <typename T> const T *Get() const {
return static_cast<const T *>(holder_->Ptr());
}
......@@ -40,7 +40,8 @@ public:
template <typename T> T *GetMutable() {
if (!IsType<T>()) {
if (*Name() == "pixel") {
// std::cout << " reset " << *Name() << std::endl;
// std::cout << " reset " << *Name() <<
// std::endl;
}
holder_.reset(new PlaceholderImp<T>(new T()));
}
......@@ -50,11 +51,12 @@ public:
template <typename T> bool IsType() const {
if (holder_) {
// printf("not null \n");
printf(" holder type : %s, this type %s \n", holder_->Type().name(),
typeid(T).name());
printf(" holder type : %s, this type %s \n",
holder_->Type().name(), typeid(T).name());
}
// std::cout << " " << holder_->Type() << " " << typeid(T) <<
// std::cout << " " << holder_->Type() << " " <<
// typeid(T) <<
// std::endl;
return holder_ != nullptr && holder_->Type() == typeid(T);
}
......@@ -65,7 +67,7 @@ public:
void SetName(const std::string *name) { name_ = name; }
private:
private:
struct Placeholder {
Placeholder() = default;
virtual ~Placeholder() = default;
......@@ -89,6 +91,6 @@ private:
std::unique_ptr<Placeholder> holder_;
friend class Scope;
const std::string *name_;
};
} // namespace framework
};
} // namespace framework
} // namespace paddle_mobile
......@@ -22,18 +22,19 @@ SOFTWARE.
#include "operators/kernel/conv_kernel.h"
namespace paddle_mobile {
namespace operators {
namespace operators {
using namespace framework;
using namespace framework;
template <typename DeviceType, typename T>
class ConvOp : public framework::OperatorWithKernel<DeviceType> {
public:
template <typename DeviceType, typename T>
class ConvOp : public framework::OperatorWithKernel<DeviceType> {
public:
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)
: framework::OperatorWithKernel<DeviceType>(type, inputs, outputs, attrs,
scope),
: framework::OperatorWithKernel<DeviceType>(
type, inputs, outputs, attrs, scope),
param_(inputs, outputs, attrs, *scope) {}
using framework::OperatorWithKernel<DeviceType>::OperatorWithKernel;
......@@ -45,9 +46,9 @@ public:
this->ClearVariables();
}
private:
private:
ConvParam param_;
};
};
} // operators
} // operators
} // paddle_mobile
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册