Skip to content

Conversation

NKNaN
Copy link
Contributor

@NKNaN NKNaN commented Jul 1, 2024

PR Category

User Experience

PR Types

New features

Description

Add paddle.cartesian_prod
rfc: PaddlePaddle/community#914

Copy link

paddle-bot bot commented Jul 1, 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.

[2, 5],
[2, 6],
[3, 5],
[3, 6]])
Copy link
Contributor

Choose a reason for hiding this comment

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

可以多加两个例子

  • 只输入 1 个 tensor
  • shape 中有 0 的情况;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的

}
// if (x.numel() == 0) {
// return;
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

这里注释的原因?是解决什么bug呢?

Copy link
Contributor Author

@NKNaN NKNaN Jul 2, 2024

Choose a reason for hiding this comment

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

这里是测试case中静态图的时候发现如果输入的 x 中有 zero-size tensor,静态图最终会返回 None,然后排查了一下应该是 reshape op 在静态图下输入是 zero-size tensor 的话会返回 None。(如果输入的 x 中有 zero-size tensor,静态图下 coordinates = paddle.stack(paddle.meshgrid(x), axis=-1) 这一步有返回结果,且coordinates也会是 zero-size tensor,最后一步 reshape 返回了 None)

如果注释掉 kernel 这里的直接 return,静态图就返回的是 [],动态图没有影响,不知道这样改对不对。

Copy link
Contributor

Choose a reason for hiding this comment

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

单独提个PR修一下,然后加个reshape的单侧

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

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@jeff41404 jeff41404 left a comment

Choose a reason for hiding this comment

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

LGTM

@luotao1
Copy link
Contributor

luotao1 commented Jul 8, 2024

可以提交中文文档

Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTMeow 🐾 for new API type annotations and print usage


Args:
x (list[Tensor]|tuple[Tensor]): Any number of 1-D input Tensors. Supported data types: bfloat16, float16, float32, float64, int32, int64, complex64 or complex128.
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

这个不重要,可以在之后哪个 PR 顺手改一下就可以~

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

@sunzhongkai588 sunzhongkai588 left a comment

Choose a reason for hiding this comment

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

LGTM for docs

@luotao1 luotao1 merged commit aee9e63 into PaddlePaddle:develop Jul 10, 2024
@luotao1 luotao1 changed the title 【Hackathon 6th No.9】Add cartesian_prod API to Paddle 【Hackathon 6th No.9】Add cartesian_prod API to Paddle -part Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants