-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Add output defs for unique kernels #52507
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@From00 麻烦研发大哥看一下 |
这两个算子的输出参数推导比较复杂,还需要对InferMeta也做修改,PR #52773 已经改过来了,可以参考下。 |
收到,麻烦老哥分享以下思路~ @AndSonder |
很抱歉,经过我们的反复讨论,你的PR暂未达到合入标准,请阅读飞桨原生算子开发规范,你可以重新提交新的PR,我们先将此PR关闭,感谢你的贡献。 |
复杂的主要是对 UniqueRawKernel 下 UniqueOpFunctor/UniqueFlattendTensorFunctor 等结构体 apply 函数的 Alloc 类型分析。输出类型的参数是根据 结构体 中 apply 函数的模板函数去确认的。apply 函数的调用在 phi::VisitDataType 中,里面通过调用 PhiVisitDataTypeCallback 传入,经过分析可以知道,cpp_type 只有两种情况 int 和 int64_t: #define _PhiForEachDataTypeTiny_(callback) \
_PhiForEachDataTypeHelper_(callback, int, DataType::INT32); \
_PhiForEachDataTypeHelper_(callback, int64_t, DataType::INT64); 这个其实是和Unique的输入参数 dtype 是一样的,所以把传入的 dtype 作为注册类型即可; 同时由于直接在InferMate中写注册信息会出现 Dim 判断报错,所以需要在 static_build.cc 中添加if条件,不在InferMate里面进行类型推导 |
非常感谢 |
PR types
Others
PR changes
Others
Describe
#51292
对于这种多嵌套有条件分支的该如何判断呢