-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[Prim] add meshgrid composite rule #51061
[Prim] add meshgrid composite rule #51061
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
❌ The PR is not created using PR's template. You can refer to this Demo. |
… add_meshgrid_composite_rule
… add_meshgrid_composite_rule
""" | ||
define composite rule of op meshgrid | ||
If the input has N tensors of size S_0, ... S_n-1, then the output will also have N tensors, where | ||
each tensor is of shape (S_0, ..., S_n-1) |
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.
explain diff of each tensor
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.
done , add an example to demonstrate it
if dim == 0: | ||
shape[i] = 1 | ||
else: | ||
shape[i] = inputs[i].shape[0] |
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.
may the logic be simplified?
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.
Yes, this op can support zero dim tensor, so we should consider 0 dim tensor as shape [1]
r2 is Tensor [[4,5], [4,5], [4,5]] | ||
""" | ||
size = len(inputs) | ||
shape = [1 for i in range(size)] |
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.
[1] * size
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.
done
shape = [1] * size | ||
for i in range(size): | ||
dim = inputs[i].dim() | ||
assert dim == 0 or dim == 1 |
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.
这儿0-d相关的逻辑补充一下0-d的测试吧
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.
done
… add_meshgrid_composite_rule
@@ -28,6 +28,7 @@ def meshgrid_wrapper(x): | |||
class TestMeshgridOp(OpTest): | |||
def setUp(self): | |||
self.op_type = "meshgrid" | |||
self.prim_op_type = "comp" | |||
self.python_api = meshgrid_wrapper |
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.
看一下python3流水线 新增一下public_python_api
PR types
Others
PR changes
Ops
Describe
add composite op meshgrid