未验证 提交 016dad46 编写于 作者: W wanghuancoder 提交者: GitHub

support selectedrows print (#56621)

上级 048ce0c4
...@@ -39,17 +39,31 @@ void PaddleKernelDialect::initialize() { ...@@ -39,17 +39,31 @@ void PaddleKernelDialect::initialize() {
} }
void PaddleKernelDialect::PrintType(ir::Type type, std::ostream &os) const { void PaddleKernelDialect::PrintType(ir::Type type, std::ostream &os) const {
AllocatedDenseTensorType tensor_type = if (type.isa<AllocatedDenseTensorType>()) {
type.dyn_cast<AllocatedDenseTensorType>(); AllocatedDenseTensorType tensor_type =
type.dyn_cast<AllocatedDenseTensorType>();
os << phi::AllocationTypeStr(tensor_type.place().GetType()) << "_"; os << phi::AllocationTypeStr(tensor_type.place().GetType()) << "_";
os << "tensor<"; os << "tensor<";
for (auto d : phi::vectorize(tensor_type.dims())) { for (auto d : phi::vectorize(tensor_type.dims())) {
os << d; os << d;
os << "x"; os << "x";
}
tensor_type.dtype().Print(os);
os << ">";
} else if (type.isa<AllocatedSelectedRowsType>()) {
AllocatedSelectedRowsType tensor_type =
type.dyn_cast<AllocatedSelectedRowsType>();
os << phi::AllocationTypeStr(tensor_type.place().GetType()) << "_";
os << "tensor<";
for (auto d : phi::vectorize(tensor_type.dims())) {
os << d;
os << "x";
}
tensor_type.dtype().Print(os);
os << ">";
} }
tensor_type.dtype().Print(os);
os << ">";
} }
void PaddleKernelDialect::PrintAttribute(ir::Attribute attr, void PaddleKernelDialect::PrintAttribute(ir::Attribute attr,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册