Skip to content

Commit

Permalink
Merge pull request #1006 from hedaoyuan/fix_973
Browse files Browse the repository at this point in the history
follow some comments with issue 973
  • Loading branch information
hedaoyuan authored Dec 28, 2016
2 parents 9efb889 + dc1ee44 commit 48b4c30
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 deletions.
10 changes: 5 additions & 5 deletions paddle/function/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
file(GLOB h_files . *_op.h)
file(GLOB cpp_files . *_op.cpp)
file(GLOB h_files . *Op.h)
file(GLOB cpp_files . *Op.cpp)

list(APPEND h_files Function.h)
list(APPEND cpp_files Function.cpp)

if(WITH_GPU)
file(GLOB cu_files . *_op_gpu.cu)
file(GLOB cu_files . *OpGpu.cu)
cuda_compile(cu_objs ${cu_files})
endif()

Expand All @@ -15,9 +15,9 @@ add_library(paddle_test_main STATIC TestMain.cpp)

if(WITH_GPU)
# TODO:
# file(GLOB test_files . *_op_test.cpp)
# file(GLOB test_files . *OpTest.cpp)
# add_executable(${test_bin} EXCLUDE_FROM_ALL ${test_files})
add_simple_unittest(cross_map_normal_op_test)
add_simple_unittest(CrossMapNormalOpTest)
endif()

add_style_check_target(paddle_function ${h_files})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
limitations under the License. */

#include "cross_map_normal_op.h"
#include "CrossMapNormalOp.h"
#include "paddle/math/Vector.h"

namespace paddle {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */

#include "hl_base.h"
#include "cross_map_normal_op.h"
#include "CrossMapNormalOp.h"

namespace paddle {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ limitations under the License. */
#include <gtest/gtest.h>
#include "FunctionTest.h"

namespace paddle {

TEST(CrossMapNormal, real) {
for (size_t numSamples : {5, 32}) {
for (size_t channels : {1, 5, 32}) {
Expand Down Expand Up @@ -69,3 +71,5 @@ TEST(CrossMapNormalGrad, real) {
}
}
}

} // namespace paddle
4 changes: 2 additions & 2 deletions paddle/function/Function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ real FuncConfig::get<real>(const std::string& key) const {

template <>
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;
return *this;
}

template <>
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;
return *this;
}
Expand Down
5 changes: 0 additions & 5 deletions paddle/function/FunctionTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,3 @@ class FunctionCompare {
};

} // namespace paddle

using paddle::FunctionCompare;
using paddle::FuncConfig;
using paddle::Dims;
using paddle::Tensor;

0 comments on commit 48b4c30

Please sign in to comment.