-
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
【new ir】add ir pybind api #55745
【new ir】add ir pybind api #55745
Changes from 2 commits
663f8f3
0b808c8
6e2b517
6e6b826
5fa75f6
a236d6c
c9eb1f9
61d0a7d
38bd4e7
94b3930
2cdd23d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,8 @@ void BindProgram(py::module *m) { | |
void BindBlock(py::module *m) { | ||
py::class_<Block> block(*m, "Block"); | ||
block.def("front", &Block::front, return_value_policy::reference) | ||
.def("get_program", | ||
[](Block &self) { return self.GetParentOp()->GetParentProgram(); }) | ||
.def("get_ops", | ||
[](Block &self) -> py::list { | ||
py::list op_list; | ||
|
@@ -81,9 +83,11 @@ void BindBlock(py::module *m) { | |
void BindOperation(py::module *m) { | ||
py::class_<Operation> op(*m, "Operation"); | ||
op.def("name", &Operation::name) | ||
.def("get_parent", &Operation::GetParent, return_value_policy::reference) | ||
.def("get_block", &Operation::GetParent, return_value_policy::reference) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 建议:get_parent_block There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
.def("num_results", &Operation::num_results) | ||
.def("num_operands", &Operation::num_operands) | ||
.def("result", &Operation::result) | ||
.def("operand", &Operation::op_operand) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 修改c++端op_operand命名为operand There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
.def("operands", | ||
[](Operation &self) -> py::list { | ||
py::list op_list; | ||
|
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.
建议:get_parent_program
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