3 #include "caffe2/core/net.h" 4 #include "caffe2/core/observer.h" 5 #include "caffe2/core/operator.h" 10 template <
typename TOpObserver,
typename TNetObserver>
15 TNetObserver* netObserver)
17 const auto& operators = subject_->GetOperators();
18 for (
auto* op : operators) {
19 auto observer = caffe2::make_unique<TOpObserver>(op, netObserver);
20 const auto* ob = observer.get();
21 op->AttachObserver(std::move(observer));
22 operator_observers_.push_back(ob);
28 std::vector<const TOpObserver*> operator_observers_;
Use this to implement a Observer using the Observer Pattern template.
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...