提交 a7ff1140 编写于 作者: H hedaoyuan

Change the ImageFunction name to BlockFunction(Consistent with the name of Layer).

上级 a83d5215
...@@ -32,7 +32,7 @@ namespace paddle { ...@@ -32,7 +32,7 @@ namespace paddle {
* \param inputs[0] Sequence data of NST format. * \param inputs[0] Sequence data of NST format.
* \param outputs[0] Image data of NCHW format. * \param outputs[0] Image data of NCHW format.
*/ */
class ImageExpandFunction : public FunctionBase { class BlockExpandFunction : public FunctionBase {
public: public:
void init(const FuncConfig& config) override { void init(const FuncConfig& config) override {
// function arguments // function arguments
...@@ -100,10 +100,10 @@ protected: ...@@ -100,10 +100,10 @@ protected:
}; };
template <DeviceType Device> template <DeviceType Device>
class ImageExpandForward : public ImageExpandFunction { class BlockExpandForward : public BlockExpandFunction {
public: public:
void init(const FuncConfig& config) override { void init(const FuncConfig& config) override {
ImageExpandFunction::init(config); BlockExpandFunction::init(config);
} }
void check(const BufferArgs& inputs, const BufferArgs& outputs) override { void check(const BufferArgs& inputs, const BufferArgs& outputs) override {
...@@ -148,10 +148,10 @@ public: ...@@ -148,10 +148,10 @@ public:
}; };
template <DeviceType Device> template <DeviceType Device>
class ImageExpandBackward : public ImageExpandFunction { class BlockExpandBackward : public BlockExpandFunction {
public: public:
void init(const FuncConfig& config) override { void init(const FuncConfig& config) override {
ImageExpandFunction::init(config); BlockExpandFunction::init(config);
} }
void check(const BufferArgs& inputs, const BufferArgs& outputs) override { void check(const BufferArgs& inputs, const BufferArgs& outputs) override {
...@@ -192,11 +192,11 @@ public: ...@@ -192,11 +192,11 @@ public:
} }
}; };
REGISTER_TYPED_FUNC(ImageExpand, CPU, ImageExpandForward); REGISTER_TYPED_FUNC(BlockExpand, CPU, BlockExpandForward);
REGISTER_TYPED_FUNC(ImageExpandGrad, CPU, ImageExpandBackward); REGISTER_TYPED_FUNC(BlockExpandGrad, CPU, BlockExpandBackward);
#ifndef PADDLE_ONLY_CPU #ifndef PADDLE_ONLY_CPU
REGISTER_TYPED_FUNC(ImageExpand, GPU, ImageExpandForward); REGISTER_TYPED_FUNC(BlockExpand, GPU, BlockExpandForward);
REGISTER_TYPED_FUNC(ImageExpandGrad, GPU, ImageExpandBackward); REGISTER_TYPED_FUNC(BlockExpandGrad, GPU, BlockExpandBackward);
#endif #endif
} // namespace paddle } // namespace paddle
...@@ -17,7 +17,7 @@ limitations under the License. */ ...@@ -17,7 +17,7 @@ limitations under the License. */
namespace paddle { namespace paddle {
TEST(ImageExpandForward, real) { TEST(BlockExpandForward, real) {
for (size_t batchSize : {5, 32}) { for (size_t batchSize : {5, 32}) {
for (size_t channels : {1, 5, 32}) { for (size_t channels : {1, 5, 32}) {
for (size_t inputHeight : {5, 33, 100}) { for (size_t inputHeight : {5, 33, 100}) {
...@@ -29,7 +29,7 @@ TEST(ImageExpandForward, real) { ...@@ -29,7 +29,7 @@ TEST(ImageExpandForward, real) {
std::vector<size_t> strides = {stride, stride}; std::vector<size_t> strides = {stride, stride};
std::vector<size_t> paddings = {padding, padding}; std::vector<size_t> paddings = {padding, padding};
std::vector<size_t> blocks = {block, block}; std::vector<size_t> blocks = {block, block};
CpuGpuFuncCompare test("ImageExpand", CpuGpuFuncCompare test("BlockExpand",
FuncConfig() FuncConfig()
.set("strides", strides) .set("strides", strides)
.set("paddings", paddings) .set("paddings", paddings)
...@@ -60,7 +60,7 @@ TEST(ImageExpandForward, real) { ...@@ -60,7 +60,7 @@ TEST(ImageExpandForward, real) {
} }
} }
TEST(ImageExpandBackward, real) { TEST(BlockExpandBackward, real) {
for (size_t batchSize : {5, 32}) { for (size_t batchSize : {5, 32}) {
for (size_t channels : {1, 5, 32}) { for (size_t channels : {1, 5, 32}) {
for (size_t inputHeight : {5, 33, 100}) { for (size_t inputHeight : {5, 33, 100}) {
...@@ -72,7 +72,7 @@ TEST(ImageExpandBackward, real) { ...@@ -72,7 +72,7 @@ TEST(ImageExpandBackward, real) {
std::vector<size_t> strides = {stride, stride}; std::vector<size_t> strides = {stride, stride};
std::vector<size_t> paddings = {padding, padding}; std::vector<size_t> paddings = {padding, padding};
std::vector<size_t> blocks = {block, block}; std::vector<size_t> blocks = {block, block};
CpuGpuFuncCompare test("ImageExpandGrad", CpuGpuFuncCompare test("BlockExpandGrad",
FuncConfig() FuncConfig()
.set("strides", strides) .set("strides", strides)
.set("paddings", paddings) .set("paddings", paddings)
......
...@@ -41,13 +41,13 @@ bool BlockExpandLayer::init(const LayerMap& layerMap, ...@@ -41,13 +41,13 @@ bool BlockExpandLayer::init(const LayerMap& layerMap,
std::vector<size_t> paddings = {(size_t)paddingH_, (size_t)paddingW_}; std::vector<size_t> paddings = {(size_t)paddingH_, (size_t)paddingW_};
std::vector<size_t> blocks = {(size_t)blockH_, (size_t)blockW_}; std::vector<size_t> blocks = {(size_t)blockH_, (size_t)blockW_};
createFunction(forward_, createFunction(forward_,
"ImageExpand", "BlockExpand",
FuncConfig() FuncConfig()
.set("strides", strides) .set("strides", strides)
.set("paddings", paddings) .set("paddings", paddings)
.set("blocks", blocks)); .set("blocks", blocks));
createFunction(backward_, createFunction(backward_,
"ImageExpandGrad", "BlockExpandGrad",
FuncConfig() FuncConfig()
.set("strides", strides) .set("strides", strides)
.set("paddings", paddings) .set("paddings", paddings)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册