-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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.51, 60】Migrate some ops into pir #58684
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
Sorry to inform you that 3157aa1's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
麻烦 merge 一下最新的分支~ |
@@ -142,7 +143,7 @@ def setUp(self): | |||
self.set_data() | |||
|
|||
def test_check_output(self): | |||
self.check_output(check_dygraph=False) | |||
self.check_output(check_dygraph=False, check_pir=True) | |||
|
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
done |
This comment was marked as resolved.
This comment was marked as resolved.
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.
- deform_conv2d 还缺少 test/legacy_test/test_deformable_conv_op.py 和 test/legacy_test/test_deformable_conv_v1_op.py 文件里相关单测的适配
- distribute_fpn_proposals 还缺少 test/legacy_test/test_detection.py 文件里相关单测的适配
@@ -108,6 +109,7 @@ def out_size( | |||
|
|||
self.mask = np.random.uniform(-1, 1, self.mask_shape).astype(self.dtype) | |||
|
|||
@test_with_pir_api |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -320,6 +322,7 @@ def out_size( | |||
|
|||
self.mask = np.random.uniform(-1, 1, self.mask_shape).astype(self.dtype) | |||
|
|||
@test_with_pir_api |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -390,6 +392,7 @@ def init_test_case(self): | |||
|
|||
|
|||
class TestModulatedDeformableConvInvalidInput(unittest.TestCase): | |||
@test_with_pir_api | |||
def test_error(self): |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -459,6 +462,7 @@ def test_invalid_groups(): | |||
|
|||
|
|||
class TestDeformConv2DAPI(unittest.TestCase): | |||
@test_with_pir_api |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
test/legacy_test/test_detection.py
Outdated
|
||
for res_stat, res_dy in zip(output_stat_np, output_dy_np): | ||
np.testing.assert_array_equal(res_stat, res_dy) | ||
|
||
@test_with_pir_api |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
test/legacy_test/test_detection.py
Outdated
np.testing.assert_array_equal(np.array(rois_stat), rois_dy) | ||
np.testing.assert_array_equal(np.array(roi_probs_stat), roi_probs_dy) | ||
np.testing.assert_array_equal(np.array(rois_num_stat), rois_num_dy) | ||
|
||
|
||
class TestMulticlassNMS2(unittest.TestCase): | ||
@test_with_pir_api |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
test/legacy_test/test_detection.py
Outdated
@@ -62,6 +63,7 @@ def static_graph(self): | |||
base.default_main_program().random_seed = self.seed | |||
yield | |||
|
|||
@test_with_pir_api |
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/legacy_test/test_detection.py
Outdated
|
||
@test_with_pir_api | ||
def static_generate_proposals( | ||
self, scores_np, bbox_deltas_np, im_info_np, anchors_np, variances_np |
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.
这里是适配的原因是?该单测并没有测试 distribute_fpn_proposals
test/legacy_test/test_detection.py
Outdated
|
||
def dynamic_generate_proposals( |
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/legacy_test/test_detection.py
Outdated
@@ -155,13 +156,34 @@ def test_generate_proposals(self): | |||
rois_dy = rois.numpy() | |||
roi_probs_dy = roi_probs.numpy() | |||
rois_num_dy = rois_num.numpy() | |||
return rois_dy, roi_probs_dy, rois_num_dy | |||
|
|||
def test_generate_proposals(self): |
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.
nice work !
还有一些地方需要修改
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
y_v1 = paddle.vision.ops.deform_conv2d( | ||
input=x, | ||
offset=offset, | ||
mask=None, |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -159,7 +161,7 @@ def static_graph_case_dcn(self): | |||
modulated=False, | |||
) | |||
|
|||
y_v2 = paddle.static.nn.common.deformable_conv( | |||
y_v2 = paddle.vision.ops.deform_conv2d( |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
y_v1 = paddle.vision.ops.deform_conv2d( | ||
input=x, | ||
offset=offset, | ||
mask=None, |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -371,7 +374,7 @@ def static_graph_case_dcn(self): | |||
modulated=False, | |||
) | |||
|
|||
y_v2 = paddle.static.nn.common.deformable_conv( | |||
y_v2 = paddle.vision.ops.deform_conv2d( | |||
input=x, | |||
offset=offset, |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -155,7 +156,7 @@ def deform_conv2d_wrapper( | |||
class TestModulatedDeformableConvOp(OpTest): | |||
def setUp(self): | |||
self.python_api = deform_conv2d_wrapper | |||
self.op_type = "deformable_conv" | |||
self.op_type = "deform_conv2d" |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
input, offset, mask, 1, 1, padding=1, groups=0 | ||
) | ||
|
||
self.assertRaises(ValueError, test_invalid_groups) | ||
|
||
|
||
class TestDeformConv2DAPI(unittest.TestCase): | ||
@test_with_pir_api | ||
def test_api(self): |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -728,6 +732,7 @@ def setUp(self): | |||
|
|||
class TestDeformConv2DError(unittest.TestCase): | |||
def test_input_error(self): | |||
@test_with_pir_api | |||
def test_input_rank_error(): |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
done |
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.
paddle.vision.ops.deform_conv2d 需要输入 weight 参数。麻烦再仔细检查一下入参是否正确吧~ deform_conv2d 的迁移比较麻烦,最好用本地环境先测试一下
test/legacy_test/test_detection.py
Outdated
def test_distribute_fpn_proposals(self): | ||
rois_np = np.random.rand(10, 4).astype('float32') | ||
rois_num_np = np.array([4, 6]).astype('int32') | ||
@test_with_pir_api |
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_with_pir_api
应该用来修饰下面的 test_distribute_fpn_proposals,test_distribute_fpn_proposals 才是用来进行结果比较的
哈哈好的,很久没编译了,周末再来调试下~ |
long 师傅最近编译了吗 ~ 如果没有的话 deform_conv2d 的适配就由我来做吧 |
好的 |
deform_conv2d 的 pir 适配将会在此 pr 里推进 #60168 |
辛苦解决一下冲突~ |
test/legacy_test/test_read_file.py
Outdated
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.
辛苦复原一下 read_file 的单测~
done |
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
decode_jpeg api 已在 #58955 里完成适配,麻烦更新一下当前 pr 的单测覆盖率和 pr 标题吧~
PR types
Others
PR changes
APIs
Description
PIR API 推全升级
将如下算子迁移升级至 pir,并更新单测
目前继承自 OpTest 的单测,在 pir 模式下暂不支持设置输入的 lod_level,因此TestDistributeFPNProposalsOp等三个单测可以先跳过
test_detection.py里的test_error 性质的单测目前暂时无法适配
新IR Python API适配升级 #58067