Caffe2 - C++ API
A deep learning, cross platform ML framework
elementwise_mul_op.h
1 #ifndef CAFFE2_OPERATORS_ELEMENTWISE_MUL_OP_H_
2 #define CAFFE2_OPERATORS_ELEMENTWISE_MUL_OP_H_
3 
4 #include <vector>
5 
6 #include "caffe2/operators/elementwise_ops.h"
7 #include "caffe2/utils/math.h"
8 
9 namespace caffe2 {
10 
11 template <class Context>
12 struct MulFunctor {
13  template <typename TIn, typename TOut>
14  bool Forward(
15  const std::vector<int>& A_dims,
16  const std::vector<int>& B_dims,
17  const TIn* A,
18  const TIn* B,
19  TOut* C,
20  Context* context) const {
21  math::Mul(
22  A_dims.size(),
23  A_dims.data(),
24  B_dims.size(),
25  B_dims.data(),
26  A,
27  B,
28  C,
29  context);
30  return true;
31  }
32 
33  template <typename TGrad, typename TIn, typename TOut>
34  bool Backward(
35  const std::vector<int>& A_dims,
36  const std::vector<int>& B_dims,
37  const TGrad* dC_data,
38  const TIn* A_data,
39  const TIn* B_data,
40  const TOut* C_data,
41  TGrad* dA_data,
42  TGrad* dB_data,
43  Context* context) const;
44 };
45 
46 } // namespace caffe2
47 
48 #endif // CAFFE2_OPERATORS_ELEMENTWISE_MUL_OP_H_
Definition: static.cpp:52
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13
Definition: static.cpp:64
Definition: static.cpp:58