Caffe2 - C++ API
A deep learning, cross platform ML framework
stats_put_ops.cc
1 #include "caffe2/operators/stats_put_ops.h"
2 #include "caffe2/core/operator.h"
3 #include "caffe2/core/stats.h"
4 #include "caffe2/core/tensor.h"
5 
6 namespace caffe2 {
7 #define REGISTER_TEMPLATED_STAT_PUT_OP(OP_NAME, STAT_NAME, STAT_MACRO) \
8  struct STAT_NAME { \
9  CAFFE_STAT_CTOR(STAT_NAME); \
10  STAT_MACRO(stat_value); \
11  }; \
12  REGISTER_CPU_OPERATOR(OP_NAME, TemplatePutOp<STAT_NAME>);
13 
14 REGISTER_TEMPLATED_STAT_PUT_OP(
15  AveragePut,
16  AveragePutStat,
17  CAFFE_AVG_EXPORTED_STAT)
18 
19 OPERATOR_SCHEMA(AveragePut)
20  .NumInputs(1)
21  .NumOutputs(0)
22  .Arg(
23  "name",
24  "(*str*): name of the stat. If not present, then uses name of input blob")
25  .Arg(
26  "magnitude_expand",
27  "(*int64_t*): number to multiply input values by (used when inputting floats, as stats can only receive integers")
28  .Arg(
29  "bound",
30  "(*boolean*): whether or not to clamp inputs to the max inputs allowed")
31  .Arg(
32  "default_value",
33  "(*float*): Optionally provide a default value for recieving empty tensors")
34  .SetDoc(R"DOC(
35  Consume a value and pushes it to the global stat registry as an average.
36 
37  Github Links:
38  - https://github.com/pytorch/pytorch/blob/master/caffe2/operators/stats_put_ops.cc
39 
40  )DOC")
41  .Input(
42  0,
43  "value",
44  "(*Tensor`<number>`*): A scalar tensor, representing any numeric value");
45 
46 REGISTER_TEMPLATED_STAT_PUT_OP(
47  IncrementPut,
48  IncrementPutStat,
49  CAFFE_EXPORTED_STAT)
50 
51 OPERATOR_SCHEMA(IncrementPut)
52  .NumInputs(1)
53  .NumOutputs(0)
54  .Arg(
55  "name",
56  "(*str*): name of the stat. If not present, then uses name of input blob")
57  .Arg(
58  "magnitude_expand",
59  "(*int64_t*): number to multiply input values by (used when inputting floats, as stats can only receive integers")
60  .Arg(
61  "bound",
62  "(*boolean*): whether or not to clamp inputs to the max inputs allowed")
63  .Arg(
64  "default_value",
65  "(*float*): Optionally provide a default value for recieving empty tensors")
66  .SetDoc(R"DOC(
67  Consume a value and pushes it to the global stat registry as an sum.
68 
69  Github Links:
70  - https://github.com/pytorch/pytorch/blob/master/caffe2/operators/stats_put_ops.cc
71 
72  )DOC")
73  .Input(
74  0,
75  "value",
76  "(*Tensor`<number>`*): A scalar tensor, representing any numeric value");
77 
78 REGISTER_TEMPLATED_STAT_PUT_OP(
79  StdDevPut,
80  StdDevPutStat,
81  CAFFE_STDDEV_EXPORTED_STAT)
82 
83 OPERATOR_SCHEMA(StdDevPut)
84  .NumInputs(1)
85  .NumOutputs(0)
86  .Arg(
87  "name",
88  "(*str*): name of the stat. If not present, then uses name of input blob")
89  .Arg(
90  "magnitude_expand",
91  "(*int64_t*): number to multiply input values by (used when inputting floats, as stats can only receive integers")
92  .Arg(
93  "bound",
94  "(*boolean*): whether or not to clamp inputs to the max inputs allowed")
95  .Arg(
96  "default_value",
97  "(*float*): Optionally provide a default value for recieving empty tensors")
98  .SetDoc(R"DOC(
99  Consume a value and pushes it to the global stat registry as an standard deviation.
100 
101  Github Links:
102  - https://github.com/pytorch/pytorch/blob/master/caffe2/operators/stats_put_ops.cc
103 
104  )DOC")
105  .Input(
106  0,
107  "value",
108  "(*Tensor`<number>`*): A scalar tensor, representing any numeric value");
109 
110 } // namespace caffe2
Definition: static.cpp:52
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13