Skip to content

Conversation

@xiaoyewww
Copy link
Contributor

PR types

Others

PR changes

Others

Description

#60436
注册算子nop

@paddle-bot
Copy link

paddle-bot bot commented Mar 7, 2024

你的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 Mar 7, 2024
@xiaoyewww xiaoyewww force-pushed the pir/nop branch 2 times, most recently from 0674e50 to 5a1404a Compare March 7, 2024 15:36
@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Mar 8, 2024
@kangguangli
Copy link
Contributor

@xiaoyewww 已经有分布式同学注册了这个Op,你可以添加下 单测即可,不需要更改op_compat.yaml。现在的错误应该是组网时传入的shape类型不符合要求,换成List试试。

@xiaoyewww
Copy link
Contributor Author

@xiaoyewww 已经有分布式同学注册了这个Op,你可以添加下 单测即可,不需要更改op_compat.yaml。现在的错误应该是组网时传入的shape类型不符合要求,换成List试试。

是指x = paddle.ones(shape=(1), dtype='float32')改成x = [paddle.ones(shape=(1), dtype='float32')]么,我看x的输入是Tensor,好像没看出来为什么要用list。

同理,#62494 也是这个报错,麻烦请教一下这是为什么?

class TestNopTranslator(test_op_translator.TestOpTranslator):
def append_op(self):
self.op_type = "nop"
x = paddle.ones(shape=(1), dtype='float32')
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
x = paddle.ones(shape=(1), dtype='float32')
x = paddle.ones(shape=(1,), dtype='float32')

现在报错处的代码如下:

def check_shape(shape): """ Check shape type and shape elements type before passing it to fill_constant """ if isinstance(shape, Variable): check_dtype(shape.dtype, 'shape', ['int32', 'int64'], 'fill_constant') else: for ele in shape: 

从报错提示也可以看出这里我们传入的shape是一个int而非list。

这是因为,在python中,元组要这样写:

>>> type((1)) <class 'int'> >>> type((1,)) <class 'tuple'> 

可以改下看看。下面的out也要做同样的修改。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

多谢,重新触发ci可以通过了~

list(APPEND DISTRIBUTED_OP_TRANSLATOR_TEST test_partial_send_translator)
list(APPEND DISTRIBUTED_OP_TRANSLATOR_TEST test_c_reduce_max_translator)
list(APPEND DISTRIBUTED_OP_TRANSLATOR_TEST test_c_reduce_prod_translator)
list(APPEND DISTRIBUTED_OP_TRANSLATOR_TEST test_nop_translator)
Copy link
Contributor

Choose a reason for hiding this comment

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

建议按字母序排列,可以减少冲突的可能

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的,这里我看上面已经不是按字母排列了,就顺序添加了

Copy link
Contributor

Choose a reason for hiding this comment

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

嗯嗯,这里麻烦你顺便调整下,现在大家的PR虽然都可以合入了,但是会因为冲突导致需要重复找人review,挺不方便的。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改,麻烦review

@kangguangli kangguangli merged commit 13b1e61 into PaddlePaddle:develop Mar 12, 2024
@xiaoyewww xiaoyewww deleted the pir/nop branch March 12, 2024 07:02
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

3 participants