Repository navigation
【PIR API adaptor No.54-56】Migrate some ops into pir - #58627
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
|
现在 ci 挂在了 PR-CI-Py3,我看了一下挂的具体位置:TestDiagEmbedAPICase 的 test_case1 . 具体解决办法可以参考 #58259 (comment) |
对的,这个我看到了,晚点修复下~ |
|
现在 ci 挂在了 PR-CI-windows,具体位置是 test/legacy_test/test_diagflat.py 的 TestDiagFlatAPI::run_static。可能的解决思路是:这个函数里的静态图构建采用 static.program_guard 来管理,如下: |
| np.testing.assert_allclose(res3, self.expected3, rtol=1e-05) | ||
| main = paddle.static.Program() | ||
| startup = paddle.static.Program() | ||
| with paddle.static.program_guard(main, startup): |
There was a problem hiding this comment.
目前挂在了 ci 阶段:PR-CI-Py3。原因应该是没有运行 startup program. 可以做如下修改:
with paddle.static.program_guard(main, startup):
exe = paddle.static.Executor(place)
exe.run(startup) # <----------------- 运行 startup program
res0, res3 = exe.run(
main,
feed={"input": self.input_np, 'input2': self.input_np2},
fetch_list=[result0, result3],
)There was a problem hiding this comment.
我重新分析了一下 ci 挂的原因
x = paddle.static.data(name='input', shape=[10, 10], dtype='float64')
x2 = paddle.static.data(name='input2', shape=[20], dtype='float64')
result0 = paddle.diagflat(x)
result3 = paddle.diagflat(x2)应该放在 with paddle.static.program_guard(main, startup): 下,比如:
main = paddle.static.Program()
startup = paddle.static.Program()
with paddle.static.program_guard(main, startup):
x = paddle.static.data(name='input', shape=[10, 10], dtype='float64')
x2 = paddle.static.data(name='input2', shape=[20], dtype='float64')
result0 = paddle.diagflat(x)
result3 = paddle.diagflat(x2)
...这样 x, x2 等变量才会被构建在指定的 program ( main, startup ) 之中
| np.testing.assert_allclose(res3, self.expected3, rtol=1e-05) | ||
| main = paddle.static.Program() | ||
| startup = paddle.static.Program() | ||
| with paddle.static.program_guard(main, startup): |
There was a problem hiding this comment.
我重新分析了一下 ci 挂的原因
x = paddle.static.data(name='input', shape=[10, 10], dtype='float64')
x2 = paddle.static.data(name='input2', shape=[20], dtype='float64')
result0 = paddle.diagflat(x)
result3 = paddle.diagflat(x2)应该放在 with paddle.static.program_guard(main, startup): 下,比如:
main = paddle.static.Program()
startup = paddle.static.Program()
with paddle.static.program_guard(main, startup):
x = paddle.static.data(name='input', shape=[10, 10], dtype='float64')
x2 = paddle.static.data(name='input2', shape=[20], dtype='float64')
result0 = paddle.diagflat(x)
result3 = paddle.diagflat(x2)
...这样 x, x2 等变量才会被构建在指定的 program ( main, startup ) 之中
MarioLulab
left a comment
There was a problem hiding this comment.
great work ~
但还有一些小问题,辛苦修改一下吧。btw,这个 pr 描述貌似有误,erfinv 应该改为 diagonal?
There was a problem hiding this comment.
这个文件下还遗漏了 test_fp16_with_gpu 这个静态图单测,麻烦大佬修改一下吧 ~ 😃
done |
* migrate diagflat, diag_embed, diagonal into pir * fix bug * fix bug * fix bug * Update test_diagflat.py * Update test_diagflat.py * fix bug * Update test_diagflat.py
* migrate diagflat, diag_embed, diagonal into pir * fix bug * fix bug * fix bug * Update test_diagflat.py * Update test_diagflat.py * fix bug * Update test_diagflat.py
PR types
Others
PR changes
APIs
Description
PIR API 推全升级
将如下算子迁移升级至 pir,并更新单测
diagflat(1/2):总计 2 个单测,打开1个单测,1个单测用来测试error的
diag_embed(3/3)
diagonal(9/9)
新IR Python API适配升级 #58067