Caffe2 - C++ API
A deep learning, cross platform ML framework
Related Pages
Modules
Data Structures
Files
C++ API
Python API
GitHub
File List
Globals
caffe2
observers
runcnt_observer.h
1
#pragma once
2
3
#include "caffe2/core/net.h"
4
#include "caffe2/core/observer.h"
5
#include "caffe2/core/operator.h"
6
#include "caffe2/observers/operator_attaching_net_observer.h"
7
8
namespace
caffe2
{
9
10
class
RunCountNetObserver;
11
12
class
CAFFE2_API
RunCountOperatorObserver
final :
public
ObserverBase
<OperatorBase> {
13
public
:
14
explicit
RunCountOperatorObserver
(
OperatorBase
* op) =
delete
;
15
RunCountOperatorObserver
(
OperatorBase
* op,
RunCountNetObserver
* netObserver);
16
~
RunCountOperatorObserver
() {}
17
std::unique_ptr<ObserverBase<OperatorBase>> rnnCopy(
18
OperatorBase
* subject,
19
int
rnn_order)
const override
;
20
21
private
:
22
void
Start()
override
;
23
void
Stop()
override
;
24
25
private
:
26
RunCountNetObserver
* netObserver_;
27
};
28
29
class
CAFFE2_API
RunCountNetObserver
final :
public
OperatorAttachingNetObserver
<
30
RunCountOperatorObserver,
31
RunCountNetObserver> {
32
public
:
33
explicit
RunCountNetObserver
(
NetBase
* subject_)
34
:
OperatorAttachingNetObserver
<
35
RunCountOperatorObserver
,
36
RunCountNetObserver
>(subject_,
this
),
37
cnt_(0) {}
38
~
RunCountNetObserver
() {}
39
40
std::string debugInfo()
override
;
41
42
friend
class
RunCountOperatorObserver;
43
44
private
:
45
void
Start()
override
;
46
void
Stop()
override
;
47
48
protected
:
49
std::atomic<int> cnt_;
50
};
51
52
}
// namespace caffe2
caffe2::RunCountNetObserver
Definition:
runcnt_observer.h:29
caffe2::ObserverBase
Use this to implement a Observer using the Observer Pattern template.
Definition:
observer.h:15
caffe2::RunCountOperatorObserver
Definition:
runcnt_observer.h:12
caffe2
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition:
blob.h:13
caffe2::OperatorAttachingNetObserver
Definition:
operator_attaching_net_observer.h:11
caffe2::NetBase
Definition:
net.h:38
caffe2::OperatorBase
Definition:
operator.h:38
Generated on Thu Mar 21 2019 13:06:17 for Caffe2 - C++ API by
1.8.11