Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

follow some comments with issue 973 #1006

Merged
merged 2 commits into from
Dec 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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;