-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[Sparse] Add infer meta #46016
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
[Sparse] Add infer meta #46016
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
|
|
||
| return kernel_context_code | ||
|
|
||
| def gene_infer_meta(self, kernel_output_names, code_indent) -> str: |
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/phi/core/sparse_coo_tensor.h
Outdated
| } | ||
|
|
||
| protected: | ||
| SparseTensorMeta meta_; |
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.
meta_成员为什么是protected?
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.
已改成private
|
|
||
| DDim dims; | ||
| DataType dtype; | ||
| DataLayout layout{DataLayout::NCHW}; |
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.
sparseTensor好像不需要layout
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.
这个layout主要用来保留dense的layout,为了to_dense的时候能够转回正确的layout
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.
OK
| phi::MetaTensor meta_out(impl_.get()); | ||
| phi::UnchangedInferMeta( | ||
| MakeMetaTensor( | ||
| *(std::static_pointer_cast<phi::SparseCooTensor>(src.impl_))), |
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.
这里是不是可以不用cast?
XiaoguangHu01
left a comment
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
* sparse infer_meta
PR types
Others
PR changes
Others
Describe