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

Add full_like composite rule #50794

Merged
merged 11 commits into from
Mar 1, 2023
Merged

Add full_like composite rule #50794

merged 11 commits into from
Mar 1, 2023

Conversation

pkuzyc
Copy link
Contributor

@pkuzyc pkuzyc commented Feb 22, 2023

PR types

Others

PR changes

Others

Describe

Add composite rule for fill_any_like op, whose python api is paddle.full_like.

@paddle-bot
Copy link

paddle-bot bot commented Feb 22, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@CLAassistant
Copy link

CLAassistant commented Feb 22, 2023

CLA assistant check
All committers have signed the CLA.

@@ -29,34 +29,45 @@ def fill_any_like_wrapper(x, value):
class TestFillAnyLikeOp(OpTest):
def setUp(self):
self.op_type = "fill_any_like"
self.python_api = fill_any_like_wrapper
self.prim_op_type = "comp"
self.enable_check_eager_comp = False
Copy link
Contributor

@Charles-hit Charles-hit Feb 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这儿不需要手动关闭,默认组合算子前向就不会测试这个,可以把self.enable_check_eager_comp = False去掉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经删除

@@ -100,8 +100,11 @@ class TestFullLikeOp1(OpTest):
# test basic
def setUp(self):
self.op_type = "fill_any_like"
self.prim_op_type = "comp"
self.enable_check_eager_comp = False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经删除

"""op name: full_like op type name: fill_any_like """
if dtype is None:
dtype = x.dtype
dtype = int_to_dtype[dtype]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

去掉上面的map,这儿改成dtype = paddle.dtype(dtype)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议改成这种用法,防止import paddle引入循环依赖
import paddle.framework.dtype as dtypes
dtype = dtypes.dtype(xxx)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修改成下面这种用法了
import paddle.framework.dtype as dtypes
dtype = dtypes.dtype(dtype)

@@ -22,6 +22,8 @@

from .primitives import * # noqa: F403
from .primreg import REGISTER_COMPOSITE, lookup_composite
import pdb
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删除了

import paddle
import paddle.nn.functional as F
from paddle.fluid import core
import pdb
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

把这个文件删除了

@pkuzyc pkuzyc force-pushed the develop branch 3 times, most recently from 6305d1c to 4bca9e5 Compare February 23, 2023 11:21


@REGISTER_COMPOSITE('fill_any_like')
def fill_any_like(x, fill_value, dtype=None, name=None):
Copy link
Contributor

@cyber-pioneer cyber-pioneer Feb 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有name输入,去掉;
这里输入默认值是无效的,不用设置。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经修改,最后一个参数改成了place,默认None

@pkuzyc pkuzyc force-pushed the develop branch 2 times, most recently from 50056f5 to 9dd6816 Compare February 24, 2023 11:44
"""op name: full_like op type name: fill_any_like."""
"""arg place is not used, add it here to keep same as python api."""
dtype = dtypes.dtype(dtype)
val = full(x.shape, fill_value, dtype, place)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

full 没有place入参,去掉

@@ -1203,7 +1203,7 @@ if($ENV{USE_STANDALONE_EXECUTOR})
endif()

set(TEST_CINN_OPS test_softmax_op test_expand_v2_op test_reduce_op
test_slice_op)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么把test_slice_op删了?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该是误删了

@pkuzyc pkuzyc force-pushed the develop branch 2 times, most recently from 351fa22 to af38405 Compare February 27, 2023 05:15
@pkuzyc pkuzyc marked this pull request as draft February 27, 2023 05:44
@pkuzyc pkuzyc marked this pull request as ready for review February 27, 2023 05:44
@pkuzyc pkuzyc marked this pull request as draft February 27, 2023 05:45
@pkuzyc pkuzyc marked this pull request as ready for review February 27, 2023 05:46
@pkuzyc pkuzyc marked this pull request as draft February 27, 2023 06:08
@pkuzyc pkuzyc marked this pull request as ready for review February 27, 2023 06:08
@pkuzyc pkuzyc marked this pull request as draft February 27, 2023 06:17
@pkuzyc pkuzyc marked this pull request as ready for review February 27, 2023 06:18
cyber-pioneer
cyber-pioneer previously approved these changes Feb 27, 2023
@cyber-pioneer
Copy link
Contributor

LGTM

Copy link
Contributor

@cyber-pioneer cyber-pioneer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@JiabinYang JiabinYang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JiabinYang JiabinYang merged commit 7468bab into PaddlePaddle:develop Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants