Caffe2 - C++ API
A deep learning, cross platform ML framework
accumulate_op.cc
1 
17 #include "caffe2/operators/accumulate_op.h"
18 
19 namespace caffe2 {
20 REGISTER_CPU_OPERATOR(Accumulate, AccumulateOp<float, CPUContext>);
21 
22 OPERATOR_SCHEMA(Accumulate)
23  .NumInputs(1)
24  .NumOutputs(1)
25  .IdenticalTypeAndShape()
26  .SetDoc(R"DOC(
27 Accumulate operator accumulates the input tensor to the output tensor. If the
28 output tensor already has the right size, we add to it; otherwise, we first
29 initialize the output tensor to all zeros, and then do accumulation. Any
30 further calls to the operator, given that no one else fiddles with the output
31 in the interim, will do simple accumulations.
32 Accumulation is done using Axpby operation as shown:
33  Y = 1*X + gamma*Y
34 where X is the input tensor, Y is the output tensor and gamma is the multiplier
35 argument.
36 )DOC")
37  .Arg("gamma", "(float, default 1.0) Accumulation multiplier")
38  .Input(0, "input", "The input tensor that has to be accumulated to the "
39  "output tensor. If the output size is not the same as input size, the "
40  "output tensor is first reshaped and initialized to zero, and only "
41  "then, accumulation is done.")
42  .Output(0, "output", "Accumulated output tensor");
43 
44 SHOULD_NOT_DO_GRADIENT(Accumulate);
45 } // namespace caffe2
Copyright (c) 2016-present, Facebook, Inc.