diff --git a/paddle/function/ConvOp.h b/paddle/function/ConvOp.h index 2cfc071255..92733bc1b7 100644 --- a/paddle/function/ConvOp.h +++ b/paddle/function/ConvOp.h @@ -104,19 +104,11 @@ public: protected: size_t getFilterHeight(const TensorShape& filter) const { - if (filter.ndims() == 5) { - return filter[3]; - } else { - return filter[2]; - } + filter[filter.ndims() - 2]; } size_t getFilterWidth(const TensorShape& filter) const { - if (filter.ndims() == 5) { - return filter[4]; - } else { - return filter[3]; - } + filter[filter.ndims() - 1]; } std::vector strides_; diff --git a/paddle/function/FunctionTest.h b/paddle/function/FunctionTest.h index 69ab33052d..ba446bf92d 100644 --- a/paddle/function/FunctionTest.h +++ b/paddle/function/FunctionTest.h @@ -296,9 +296,9 @@ public: compareOutputs(); } - std::shared_ptr getCpuFunction() const { return function1_; } + std::shared_ptr getFunction1() const { return function1_; } - std::shared_ptr getGpuFunction() const { return function2_; } + std::shared_ptr getFunction2() const { return function2_; } protected: // only init cpu argument, gpu argument copy from cpu argument.