提交 48b4c306 编写于 作者: H hedaoyuan 提交者: GitHub

Merge pull request #1006 from hedaoyuan/fix_973

follow some comments with issue 973
file(GLOB h_files . *_op.h) file(GLOB h_files . *Op.h)
file(GLOB cpp_files . *_op.cpp) file(GLOB cpp_files . *Op.cpp)
list(APPEND h_files Function.h) list(APPEND h_files Function.h)
list(APPEND cpp_files Function.cpp) list(APPEND cpp_files Function.cpp)
if(WITH_GPU) if(WITH_GPU)
file(GLOB cu_files . *_op_gpu.cu) file(GLOB cu_files . *OpGpu.cu)
cuda_compile(cu_objs ${cu_files}) cuda_compile(cu_objs ${cu_files})
endif() endif()
...@@ -15,9 +15,9 @@ add_library(paddle_test_main STATIC TestMain.cpp) ...@@ -15,9 +15,9 @@ add_library(paddle_test_main STATIC TestMain.cpp)
if(WITH_GPU) if(WITH_GPU)
# TODO: # TODO:
# file(GLOB test_files . *_op_test.cpp) # file(GLOB test_files . *OpTest.cpp)
# add_executable(${test_bin} EXCLUDE_FROM_ALL ${test_files}) # add_executable(${test_bin} EXCLUDE_FROM_ALL ${test_files})
add_simple_unittest(cross_map_normal_op_test) add_simple_unittest(CrossMapNormalOpTest)
endif() endif()
add_style_check_target(paddle_function ${h_files}) add_style_check_target(paddle_function ${h_files})
......
...@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ...@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#include "cross_map_normal_op.h" #include "CrossMapNormalOp.h"
#include "paddle/math/Vector.h" #include "paddle/math/Vector.h"
namespace paddle { namespace paddle {
......
...@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and ...@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#include "hl_base.h" #include "hl_base.h"
#include "cross_map_normal_op.h" #include "CrossMapNormalOp.h"
namespace paddle { namespace paddle {
......
...@@ -15,6 +15,8 @@ limitations under the License. */ ...@@ -15,6 +15,8 @@ limitations under the License. */
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "FunctionTest.h" #include "FunctionTest.h"
namespace paddle {
TEST(CrossMapNormal, real) { TEST(CrossMapNormal, real) {
for (size_t numSamples : {5, 32}) { for (size_t numSamples : {5, 32}) {
for (size_t channels : {1, 5, 32}) { for (size_t channels : {1, 5, 32}) {
...@@ -69,3 +71,5 @@ TEST(CrossMapNormalGrad, real) { ...@@ -69,3 +71,5 @@ TEST(CrossMapNormalGrad, real) {
} }
} }
} }
} // namespace paddle
...@@ -32,14 +32,14 @@ real FuncConfig::get<real>(const std::string& key) const { ...@@ -32,14 +32,14 @@ real FuncConfig::get<real>(const std::string& key) const {
template <> template <>
FuncConfig& FuncConfig::set<size_t>(const std::string& key, size_t v) { FuncConfig& FuncConfig::set<size_t>(const std::string& key, size_t v) {
CHECK(valueMap_.count(key) == 0) << "Duplicated value: " << key; CHECK_EQ(valueMap_.count(key), 0) << "Duplicated value: " << key;
valueMap_[key].s = v; valueMap_[key].s = v;
return *this; return *this;
} }
template <> template <>
FuncConfig& FuncConfig::set<real>(const std::string& key, real v) { FuncConfig& FuncConfig::set<real>(const std::string& key, real v) {
CHECK(valueMap_.count(key) == 0) << "Duplicated value: " << key; CHECK_EQ(valueMap_.count(key), 0) << "Duplicated value: " << key;
valueMap_[key].r = v; valueMap_[key].r = v;
return *this; return *this;
} }
......
...@@ -95,8 +95,3 @@ protected: ...@@ -95,8 +95,3 @@ protected:
}; };
} // namespace paddle } // namespace paddle
using paddle::FunctionCompare;
using paddle::FuncConfig;
using paddle::Dims;
using paddle::Tensor;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册