Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
bdeb479c
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
bdeb479c
编写于
3年前
作者:
C
Chen Weihang
提交者:
GitHub
3年前
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
unify naming style (#39481)
上级
739da6cb
develop
Ligoml-patch-1
ZHUI-patch-1
add_some_yaml_config
dingjiaweiww-patch-1
dy2static
enable_eager_model_test
final_state_intermediate
fix-numpy-issue
fix_rnn_docs
fix_tensor_type
inplace_addto
move_embedding_to_phi
move_histogram_to_pten
move_sgd_to_phi
move_slice_to_pten
move_temporal_shift_to_phi
move_yolo_box_to_phi
npu_fix_alloc
prv-md-even-more
release/2.3
release/2.3-fc-ernie-fix
release/2.4
revert-39268-dev/remove_concat_fluid_kernel
revert-40170-support_partial_grad
revert-41056-revert-40727-move_some_activaion_to_phi
revert-41065-revert-40993-mv_ele_floordiv_pow
revert-41068-revert-40790-phi_new
revert-41944-smaller_inference_api_test
revert-42149-do-not-reset-default-stream-for-stream-safe-cuda-allocator
revert-43155-fix_ut_tempfile
revert-43882-revert-41944-smaller_inference_api_test
revert-45808-phi/simplify_size_op
revert-46827-deform_comment
support_weight_transpose
zhiqiu-patch-1
v2.4.0-rc0
v2.3.2
v2.3.1
v2.3.0
v2.3.0-rc0
无相关合并请求
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
10 deletion
+10
-10
paddle/pten/core/infermeta_utils.cc
paddle/pten/core/infermeta_utils.cc
+2
-2
paddle/pten/core/infermeta_utils.h
paddle/pten/core/infermeta_utils.h
+6
-6
paddle/pten/tests/core/test_meta_fn_utils.cc
paddle/pten/tests/core/test_meta_fn_utils.cc
+2
-2
未找到文件。
paddle/pten/core/infermeta_utils.cc
浏览文件 @
bdeb479c
...
...
@@ -83,8 +83,8 @@ MetaTensor* InferMetaContext::MutableOutputAt(size_t idx) {
return
outputs_
.
at
(
idx
).
get
();
}
MetaF
unctionMap
&
MetaFunctionMap
::
Instance
()
{
static
MetaF
unctionMap
g_meta_fn_map
;
MetaF
nFactory
&
MetaFnFactory
::
Instance
()
{
static
MetaF
nFactory
g_meta_fn_map
;
return
g_meta_fn_map
;
}
...
...
This diff is collapsed.
Click to expand it.
paddle/pten/core/infermeta_utils.h
浏览文件 @
bdeb479c
...
...
@@ -194,9 +194,9 @@ struct InferMetaFnImpl<Return (*)(Args...), infer_meta_fn> {
};
};
class
MetaF
unctionMap
{
class
MetaF
nFactory
{
public:
static
MetaF
unctionMap
&
Instance
();
static
MetaF
nFactory
&
Instance
();
bool
Contains
(
const
std
::
string
&
kernel_name_prefix
)
const
{
return
meta_fn_map_
.
count
(
kernel_name_prefix
)
>
0
;
...
...
@@ -225,7 +225,7 @@ class MetaFunctionMap {
}
private:
MetaF
unctionMap
()
=
default
;
MetaF
nFactory
()
=
default
;
/**
* [ Why use kernel name prefix? ]
...
...
@@ -243,14 +243,14 @@ class MetaFunctionMap {
*/
paddle
::
flat_hash_map
<
std
::
string
,
InferMetaFn
>
meta_fn_map_
;
DISABLE_COPY_AND_ASSIGN
(
MetaF
unctionMap
);
DISABLE_COPY_AND_ASSIGN
(
MetaF
nFactory
);
};
struct
InferMetaFnRegistrar
{
InferMetaFnRegistrar
(
const
char
*
kernel_name_prefix
,
InferMetaFn
infer_meta_fn
)
{
MetaF
unctionMap
::
Instance
().
Insert
(
kernel_name_prefix
,
std
::
move
(
infer_meta_fn
));
MetaF
nFactory
::
Instance
().
Insert
(
kernel_name_prefix
,
std
::
move
(
infer_meta_fn
));
}
};
...
...
This diff is collapsed.
Click to expand it.
paddle/pten/tests/core/test_meta_fn_utils.cc
浏览文件 @
bdeb479c
...
...
@@ -22,7 +22,7 @@ limitations under the License. */
namespace
pten
{
namespace
tests
{
TEST
(
MetaF
unctionMap
,
InferMetaFnExists
)
{
TEST
(
MetaF
nFactory
,
InferMetaFnExists
)
{
pten
::
DenseTensor
dense_x
;
dense_x
.
Resize
(
pten
::
framework
::
make_ddim
({
3
,
4
}));
...
...
@@ -38,7 +38,7 @@ TEST(MetaFunctionMap, InferMetaFnExists) {
ctx
.
EmplaceBackInput
(
shared_meat_x
);
ctx
.
EmplaceBackOutput
(
shared_meta_out
);
ctx
.
SetMetaConfig
(
/*is_runtime=*/
true
);
pten
::
MetaF
unctionMap
::
Instance
().
Get
(
"sign"
)(
&
ctx
);
pten
::
MetaF
nFactory
::
Instance
().
Get
(
"sign"
)(
&
ctx
);
EXPECT_EQ
(
dense_out1
.
dims
().
size
(),
dense_out2
.
dims
().
size
());
EXPECT_EQ
(
dense_out1
.
dims
()[
0
],
dense_out2
.
dims
()[
0
]);
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
反馈
建议
客服
返回
顶部