Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
6b8ef2f2
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
6b8ef2f2
编写于
8月 10, 2023
作者:
X
xiaoye
提交者:
GitHub
8月 10, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(hihg-performance): use std::move to instead of copy-ctor (#56093)
上级
689bcad5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
49 addition
and
49 deletion
+49
-49
paddle/phi/core/enforce.h
paddle/phi/core/enforce.h
+49
-49
未找到文件。
paddle/phi/core/enforce.h
浏览文件 @
6b8ef2f2
...
@@ -415,59 +415,59 @@ struct EnforceNotMet : public std::exception {
...
@@ -415,59 +415,59 @@ struct EnforceNotMet : public std::exception {
* PADDLE_ENFORCE(a, b, "some simple enforce failed between %d numbers", 2)
* PADDLE_ENFORCE(a, b, "some simple enforce failed between %d numbers", 2)
*/
*/
#define PADDLE_ENFORCE_NOT_NULL(__VAL, ...) \
#define PADDLE_ENFORCE_NOT_NULL(__VAL, ...)
\
do { \
do {
\
if (UNLIKELY(nullptr == (__VAL))) { \
if (UNLIKELY(nullptr == (__VAL))) {
\
auto __summary__ = phi::ErrorSummary(__VA_ARGS__); \
auto __summary__ = phi::ErrorSummary(__VA_ARGS__);
\
auto __message__ = ::paddle::string::Sprintf( \
auto __message__ = ::paddle::string::Sprintf(
\
"%s\n [Hint: " #__VAL " should not be null.]", \
"%s\n [Hint: " #__VAL " should not be null.]",
\
__summary__.error_message()); \
__summary__.error_message());
\
__THROW_ERROR_INTERNAL__( \
__THROW_ERROR_INTERNAL__(
\
phi::ErrorSummary(__summary__.code(),
__message__
)); \
phi::ErrorSummary(__summary__.code(),
std::move(__message__)
)); \
} \
}
\
} while (0)
} while (0)
#define PADDLE_WARN_NOT_NULL(__VAL, ...) \
#define PADDLE_WARN_NOT_NULL(__VAL, ...)
\
do { \
do {
\
if (UNLIKELY(nullptr == (__VAL))) { \
if (UNLIKELY(nullptr == (__VAL))) {
\
auto __summary__ = phi::ErrorSummary(__VA_ARGS__); \
auto __summary__ = phi::ErrorSummary(__VA_ARGS__);
\
auto __message__ = ::paddle::string::Sprintf( \
auto __message__ = ::paddle::string::Sprintf(
\
"%s\n [Hint: " #__VAL " should not be null.]", \
"%s\n [Hint: " #__VAL " should not be null.]",
\
__summary__.error_message()); \
__summary__.error_message());
\
::phi::enforce::ThrowWarnInternal(
__message__);
\
::phi::enforce::ThrowWarnInternal(
std::move(__message__));
\
} \
}
\
} while (0)
} while (0)
#define __PADDLE_BINARY_COMPARE(__VAL1, __VAL2, __CMP, __INV_CMP, ...) \
#define __PADDLE_BINARY_COMPARE(__VAL1, __VAL2, __CMP, __INV_CMP, ...)
\
do { \
do {
\
auto __val1 = (__VAL1); \
auto __val1 = (__VAL1);
\
auto __val2 = (__VAL2); \
auto __val2 = (__VAL2);
\
using __TYPE1__ = decltype(__val1); \
using __TYPE1__ = decltype(__val1);
\
using __TYPE2__ = decltype(__val2); \
using __TYPE2__ = decltype(__val2);
\
using __COMMON_TYPE1__ = \
using __COMMON_TYPE1__ =
\
::phi::details::CommonType1<__TYPE1__, __TYPE2__>; \
::phi::details::CommonType1<__TYPE1__, __TYPE2__>;
\
using __COMMON_TYPE2__ = \
using __COMMON_TYPE2__ =
\
::phi::details::CommonType2<__TYPE1__, __TYPE2__>; \
::phi::details::CommonType2<__TYPE1__, __TYPE2__>;
\
bool __is_not_error = (static_cast<__COMMON_TYPE1__>(__val1))__CMP( \
bool __is_not_error = (static_cast<__COMMON_TYPE1__>(__val1))__CMP(
\
static_cast<__COMMON_TYPE2__>(__val2)); \
static_cast<__COMMON_TYPE2__>(__val2));
\
if (UNLIKELY(!__is_not_error)) { \
if (UNLIKELY(!__is_not_error)) {
\
auto __summary__ = phi::ErrorSummary(__VA_ARGS__); \
auto __summary__ = phi::ErrorSummary(__VA_ARGS__);
\
constexpr bool __kCanToString__ = \
constexpr bool __kCanToString__ =
\
::phi::details::CanToString<__TYPE1__>::kValue && \
::phi::details::CanToString<__TYPE1__>::kValue &&
\
::phi::details::CanToString<__TYPE2__>::kValue; \
::phi::details::CanToString<__TYPE2__>::kValue;
\
auto __message__ = ::paddle::string::Sprintf( \
auto __message__ = ::paddle::string::Sprintf(
\
"%s\n [Hint: Expected %s " #__CMP \
"%s\n [Hint: Expected %s " #__CMP
\
" %s, but received %s " #__INV_CMP " %s.]", \
" %s, but received %s " #__INV_CMP " %s.]",
\
__summary__.error_message(), \
__summary__.error_message(),
\
#__VAL1, \
#__VAL1,
\
#__VAL2, \
#__VAL2,
\
::phi::details::BinaryCompareMessageConverter< \
::phi::details::BinaryCompareMessageConverter<
\
__kCanToString__>::Convert(#__VAL1, __val1), \
__kCanToString__>::Convert(#__VAL1, __val1),
\
::phi::details::BinaryCompareMessageConverter< \
::phi::details::BinaryCompareMessageConverter<
\
__kCanToString__>::Convert(#__VAL2, __val2)); \
__kCanToString__>::Convert(#__VAL2, __val2));
\
__THROW_ERROR_INTERNAL__( \
__THROW_ERROR_INTERNAL__(
\
phi::ErrorSummary(__summary__.code(),
__message__));
\
phi::ErrorSummary(__summary__.code(),
std::move(__message__)));
\
} \
}
\
} while (0)
} while (0)
#define PADDLE_ENFORCE_EQ(__VAL0, __VAL1, ...) \
#define PADDLE_ENFORCE_EQ(__VAL0, __VAL1, ...) \
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录