-
-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Labels
Description
Implement an interface for users to register pre/post transformation/apply observers for BackendPart
and Transformer
.
@classmethod
def regiseter_prior_observer(cls, callback):
cls.prior_observer.append(callback)
@classmethod
def register_post_observer(cls, callback):
# similar code
def apply(self, ugraph):
for callback in type(self).prior_observer:
callback(ugraph)
# do work with ugraph
for callback in type(self).prior_observer:
callback(ugraph)
Unify the interface for users to inspect the graph, such as inject pdb
break point in the callback.
Note that these observers should not introduce side-effect to the graph.