-
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
【PIR API adaptor No.50、57、67】Migrate some ops into pir #58466
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
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
cumprod 的BF16单测有一些问题,可以把报错日志在此PR下comment记录下,先不开启,我们内部来看是什么问题 |
有一些单测在本pr中没有打开,方便在pr描述中说明一下没有打开的原因嘛~ |
@0x45f 修改好了~ |
test_cumprod_op.py这个文件的代码风格检查挂了,麻烦本地pre-commit后再提交下~ |
done |
继承自unittest.TestCase的单测为什么没有打开呢?是打开之后会报错吗? |
好问题,这种应该怎么打开呢?我看上期任务的PR模板也是这么写的 class TestCumprodAPI(unittest.TestCase):
def init_dtype(self):
self.dtype = 'float64'
self.shape = [2, 3, 10, 10]
def setUp(self):
paddle.enable_static()
self.init_dtype()
self.x = (np.random.rand(2, 3, 10, 10) + 0.5).astype(self.dtype)
self.place = [paddle.CPUPlace()]
if core.is_compiled_with_cuda():
self.place.append(paddle.CUDAPlace(0))
# test static graph api.
def test_static_api(self):
paddle.enable_static()
def run(place):
with paddle.static.program_guard(paddle.static.Program()):
x = paddle.static.data('X', self.shape, dtype=self.dtype)
out = paddle.cumprod(x, -2)
exe = paddle.static.Executor(place)
res = exe.run(feed={'X': self.x}, fetch_list=[out])
out_ref = np.cumprod(self.x, -2)
for r in res:
np.testing.assert_allclose(out_ref, r, rtol=1e-05)
for place in self.place:
run(place)
# test dynamic graph api.
def test_dygraph_api(self):
def run(place):
paddle.disable_static(place)
x = paddle.to_tensor(self.x)
out = paddle.cumprod(x, 1)
out_ref = np.cumprod(self.x, 1)
np.testing.assert_allclose(out_ref, out.numpy(), rtol=1e-05)
paddle.enable_static()
for place in self.place:
run(place) |
#58067 本期任务的描述《四、单测验证》部分有提到可以使用装饰器打开这类单测。我先合入这个PR了,可以另提一个PR打开继承自TestCase的单测~ |
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
APIs
Description
PIR API 推全升级
将如下算子迁移升级至 pir,并更新单测
cumprod(6/7):总计 7 个单测,打开6个单测,1个单测继承自unittest.TestCase没有覆盖到
digamma(4/5):总计 5 个单测,打开4个单测,1个单测继承自unittest.TestCase没有覆盖到
erfinv(5/5)
新IR Python API适配升级 #58067