expose observers to python

Summary: observer framework can now be used in python + a small writeup of how to use it

Reviewed By: salexspb

Differential Revision: D5905002

fbshipit-source-id: e40ec24a55e08fb73beea9b4f3b68e71fc66ffb1
This commit is contained in:
Bram Wasti
2017-10-10 15:57:48 -07:00
committed by Facebook Github Bot
parent f11ff5befb
commit 63caca89db
18 changed files with 301 additions and 102 deletions

View File

@ -1878,6 +1878,13 @@ class Net(object):
* [ScopedBlobReference(b) for b in outputs]
)
def AddObserver(self, observer):
return C.add_observer_to_net(self._net.name, observer)
# This will return any observer added to the net.
def GetObserver(self, index):
return C.get_observer_from_net(self._net.name, index)
@property
def external_inputs(self):
return [_get_blob_ref(x) for x in self._net.external_input]