-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Cmrnorm #854
Cmrnorm #854
Changes from all commits
529f24c
9503590
e357f27
a1d2abc
ce1d98e
4ebb3eb
9171ab0
d2d0010
22a5e47
558e869
d11e2b4
f13aeb5
cee9346
148bd4d
5fddd99
bf32411
f1a94e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
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) | ||
cuda_compile(cu_objs ${cu_files}) | ||
endif() | ||
|
||
add_library(paddle_function STATIC ${cpp_files} ${cu_objs}) | ||
|
||
add_library(paddle_test_main STATIC TestMain.cpp) | ||
|
||
if(WITH_GPU) | ||
# TODO: | ||
# file(GLOB test_files . *_op_test.cpp) | ||
# add_executable(${test_bin} EXCLUDE_FROM_ALL ${test_files}) | ||
add_simple_unittest(cross_map_normal_op_test) | ||
endif() | ||
|
||
add_style_check_target(paddle_function ${h_files}) | ||
add_style_check_target(paddle_function ${cpp_files}) | ||
if(WITH_GPU) | ||
add_style_check_target(paddle_function ${cu_files}) | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
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 "Function.h" | ||
|
||
namespace paddle { | ||
|
||
template <> | ||
size_t FuncConfig::get<size_t>(const std::string& key) const { | ||
auto it = valueMap_.find(key); | ||
CHECK(it != valueMap_.end()) << "Cannot find value: '" << key << "'"; | ||
return it->second.s; | ||
} | ||
|
||
template <> | ||
real FuncConfig::get<real>(const std::string& key) const { | ||
auto it = valueMap_.find(key); | ||
CHECK(it != valueMap_.end()) << "Cannot find value: '" << key << "'"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CHECK ==> CHECK_NE There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CHECK_NE not support type of it. |
||
return it->second.r; | ||
} | ||
|
||
template <> | ||
FuncConfig& FuncConfig::set<size_t>(const std::string& key, size_t v) { | ||
CHECK(valueMap_.count(key) == 0) << "Duplicated value: " << key; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we use count > 0 to indicate there is already a value for the key? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CHECK(true) will pass. There need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里应该是 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CHECK ==> CHECK_EQ |
||
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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as line 35 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CHECK_EQ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CHECK ==> CHECK_EQ |
||
valueMap_[key].r = v; | ||
return *this; | ||
} | ||
|
||
ClassRegistrar<FunctionBase> FunctionBase::funcRegistrar_; | ||
|
||
} // namespace paddle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CHECK ==> CHECK_NE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CHECK_NE not support type of it.