Skip to content

【PIR API adaptor No.51, 60】Migrate some ops into pir - #58684

Merged
0x45f merged 10 commits into
PaddlePaddle:developfrom
longranger2:pir4
Dec 26, 2023
Merged

0x45f merged 10 commits into
PaddlePaddle:developfrom
longranger2:pir4

Conversation

@longranger2

@longranger2 longranger2 commented Nov 4, 2023 •

Copy link
Copy Markdown
Contributor

PR types

Others

PR changes

APIs

Description

PIR API 推全升级
将如下算子迁移升级至 pir,并更新单测

  1. decode_jpeg:暂不支持
  2. distribute_fpn_proposals(13/16):
  • 目前继承自 OpTest 的单测,在 pir 模式下暂不支持设置输入的 lod_level,因此TestDistributeFPNProposalsOp等三个单测可以先跳过

  • test_detection.py里的test_error 性质的单测目前暂时无法适配

  • 新IR Python API适配升级 #58067

@paddle-bot

paddle-bot Bot commented Nov 4, 2023

Copy link
Copy Markdown

你的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.

@paddle-bot paddle-bot Bot added the contributor External developers label Nov 4, 2023
@longranger2 longranger2 changed the title 【PIR API adaptor No.54-56】Migrate some ops into pir 【PIR API adaptor No.51-52, 60】Migrate some ops into pir Nov 5, 2023
@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Nov 6, 2023
@paddle-ci-bot

paddle-ci-bot Bot commented Nov 12, 2023

Copy link
Copy Markdown

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.

@MarioLulab

Copy link
Copy Markdown
Collaborator

麻烦 merge 一下最新的分支~

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.

@MarioLulab

This comment was marked as resolved.

@longranger2

Copy link
Copy Markdown
Contributor Author

decode_jpeg 和 deform_conv2d 的单测还没添加

done

@MarioLulab

This comment was marked as resolved.

@MarioLulab MarioLulab left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  1. deform_conv2d 还缺少 test/legacy_test/test_deformable_conv_op.py 和 test/legacy_test/test_deformable_conv_v1_op.py 文件里相关单测的适配
  2. distribute_fpn_proposals 还缺少 test/legacy_test/test_detection.py 文件里相关单测的适配

Comment thread test/legacy_test/test_deform_conv2d.py Outdated

self.mask = np.random.uniform(-1, 1, self.mask_shape).astype(self.dtype)

@test_with_pir_api

This comment was marked as off-topic.

Comment thread test/legacy_test/test_deform_conv2d.py Outdated

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 off-topic.


class TestModulatedDeformableConvInvalidInput(unittest.TestCase):
@test_with_pir_api
def test_error(self):

This comment was marked as off-topic.



class TestDeformConv2DAPI(unittest.TestCase):
@test_with_pir_api

This comment was marked as off-topic.

Comment thread 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.

Comment thread test/legacy_test/test_detection.py Outdated


class TestMulticlassNMS2(unittest.TestCase):
@test_with_pir_api

This comment was marked as off-topic.

Comment thread test/legacy_test/test_detection.py Outdated
base.default_main_program().random_seed = self.seed
yield

@test_with_pir_api

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这里适配的原因是?

Comment thread 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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这里是适配的原因是?该单测并没有测试 distribute_fpn_proposals

Comment thread test/legacy_test/test_detection.py Outdated
)
return rois_stat, roi_probs_stat, rois_num_stat

def dynamic_generate_proposals(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

同问

Comment thread test/legacy_test/test_detection.py Outdated
rois_num_dy = rois_num.numpy()
return rois_dy, roi_probs_dy, rois_num_dy

def test_generate_proposals(self):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

同问

@MarioLulab MarioLulab left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment thread test/legacy_test/test_deform_conv2d.py Outdated
Comment on lines 147 to 150
y_v1 = paddle.vision.ops.deform_conv2d(
input=x,
offset=offset,
mask=None,

This comment was marked as off-topic.

Comment thread test/legacy_test/test_deform_conv2d.py Outdated
)

y_v2 = paddle.static.nn.common.deformable_conv(
y_v2 = paddle.vision.ops.deform_conv2d(

This comment was marked as off-topic.

Comment thread test/legacy_test/test_deform_conv2d.py Outdated
Comment on lines 360 to 363
y_v1 = paddle.vision.ops.deform_conv2d(
input=x,
offset=offset,
mask=None,

This comment was marked as off-topic.

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.

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.


class TestDeformConv2DAPI(unittest.TestCase):
@test_with_pir_api
def test_api(self):

This comment was marked as off-topic.

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.

@longranger2

Copy link
Copy Markdown
Contributor Author

done

@MarioLulab MarioLulab left a comment

Copy link
Copy Markdown
Collaborator

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 的迁移比较麻烦,最好用本地环境先测试一下

Comment thread 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

Copy link
Copy Markdown
Collaborator

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 才是用来进行结果比较的

@longranger2

Copy link
Copy Markdown
Contributor Author

paddle.vision.ops.deform_conv2d 需要输入 weight 参数。麻烦再仔细检查一下入参是否正确吧~ deform_conv2d 的迁移比较麻烦,最好用本地环境先测试一下

哈哈好的,很久没编译了,周末再来调试下~

@MarioLulab

Copy link
Copy Markdown
Collaborator

paddle.vision.ops.deform_conv2d 需要输入 weight 参数。麻烦再仔细检查一下入参是否正确吧~ deform_conv2d 的迁移比较麻烦,最好用本地环境先测试一下

哈哈好的,很久没编译了,周末再来调试下~

long 师傅最近编译了吗 ~ 如果没有的话 deform_conv2d 的适配就由我来做吧

@longranger2

Copy link
Copy Markdown
Contributor Author

paddle.vision.ops.deform_conv2d 需要输入 weight 参数。麻烦再仔细检查一下入参是否正确吧~ deform_conv2d 的迁移比较麻烦,最好用本地环境先测试一下

哈哈好的,很久没编译了,周末再来调试下~

long 师傅最近编译了吗 ~ 如果没有的话 deform_conv2d 的适配就由我来做吧

好的

@MarioLulab

Copy link
Copy Markdown
Collaborator

deform_conv2d 的 pir 适配将会在此 pr 里推进 #60168
long 师傅有空的时候可以关注下~ 然后顺便修改一下当前 pr 的标题和复原 deform_conv2d 的更改吧

@longranger2 longranger2 changed the title 【PIR API adaptor No.51-52, 60】Migrate some ops into pir 【PIR API adaptor No.51, 60】Migrate some ops into pir Dec 22, 2023
@MarioLulab

Copy link
Copy Markdown
Collaborator

辛苦解决一下冲突~

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

辛苦复原一下 read_file 的单测~

@longranger2

Copy link
Copy Markdown
Contributor Author

done

@MarioLulab MarioLulab left a comment

Copy link
Copy Markdown
Collaborator

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 标题吧~

@0x45f
0x45f merged commit a134bf9 into PaddlePaddle:develop Dec 26, 2023
Wanglongzhi2001 pushed a commit to Wanglongzhi2001/Paddle that referenced this pull request Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers HappyOpenSource 快乐开源活动issue与PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants