-
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
Add full_like composite rule #50794
Add full_like composite rule #50794
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -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 |
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.
这儿不需要手动关闭,默认组合算子前向就不会测试这个,可以把self.enable_check_eager_comp = False
去掉
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.
已经删除
@@ -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 |
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.
同上
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.
已经删除
"""op name: full_like op type name: fill_any_like """ | ||
if dtype is None: | ||
dtype = x.dtype | ||
dtype = int_to_dtype[dtype] |
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.
去掉上面的map,这儿改成dtype = paddle.dtype(dtype)
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.
建议改成这种用法,防止import paddle引入循环依赖
import paddle.framework.dtype as dtypes
dtype = dtypes.dtype(xxx)
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.
修改成下面这种用法了
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 |
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.
remove
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.
删除了
import paddle | ||
import paddle.nn.functional as F | ||
from paddle.fluid import core | ||
import pdb |
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.
remove
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.
把这个文件删除了
6305d1c
to
4bca9e5
Compare
|
||
|
||
@REGISTER_COMPOSITE('fill_any_like') | ||
def fill_any_like(x, fill_value, dtype=None, name=None): |
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.
没有name输入,去掉;
这里输入默认值是无效的,不用设置。
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.
已经修改,最后一个参数改成了place,默认None
50056f5
to
9dd6816
Compare
"""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) |
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.
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) |
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.
为什么把test_slice_op删了?
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.
应该是误删了
351fa22
to
af38405
Compare
LGTM |
c74ecc9
to
f34adc3
Compare
add cinn op test to CMakeLists.txt fix code style
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.
LGTM
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.
LGTM
PR types
Others
PR changes
Others
Describe
Add composite rule for fill_any_like op, whose python api is paddle.full_like.