Currently, C++ is the only way to register ops (correct me if I missed something),
this requires user to recompile.
Is it intentional?
If not, I would like to enable the python way to register ops, which users could try quickly and enable to opportunity to deliver new op implementation separately: No need to pack all in one library but provide the related python scripts.
And another follow up, is there a plan to make ops hot plugable?
What I mean by registering ops from python site is like:
# New API (TBD, just for concept explanation)
register_op("my_op")
my_op.describe("my_op xxxxx")
my_op.add_type_rel(...)
# Existing API
register_op_attr("my_op", ...)
register_intrin_lowering("my_op", ...)
Hot Plug OPs
For the following up about hot plug ops, taking op “image.resize” for example:
I suspect that we don’t have a public API to add operators on the python side right now, and I don’t know the reason why not. If you wanted to, you may just expose OpRegEntry::RegisterOrGet
I also wish we could easily add hot pluggable Relay operators (whether for testing, easily supporting additional ops, etc.). Unfortunately I believe the main reason (or at least one major reason) this is currently not available is because type relations (and basically all the type inference machinery) is not exported across the FFI. I’m not sure how easy it is to allow this, and whether or not we want to commit to this with what we currently have vs. a longer term picture.