Skip to content

Commit

Permalink
[MLIR] [Python] Add owner to mlir.ir.Block
Browse files Browse the repository at this point in the history
Provides a way for python users to access the owning Operation from a Block.
  • Loading branch information
teqdruid committed Aug 19, 2021
1 parent 234c4d2 commit 96fbd5c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mlir/lib/Bindings/Python/IRCore.cpp
Expand Up @@ -2200,6 +2200,12 @@ void mlir::python::populateIRCore(py::module &m) {
// Mapping of PyBlock.
//----------------------------------------------------------------------------
py::class_<PyBlock>(m, "Block")
.def_property_readonly(
"owner",
[](PyBlock &self) {
return self.getParentOperation()->createOpView();
},
"Returns the owning operation of this block.")
.def_property_readonly(
"arguments",
[](PyBlock &self) {
Expand Down

0 comments on commit 96fbd5c

Please sign in to comment.