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
operators
exp_op.cc
1
#include "caffe2/operators/elementwise_op.h"
2
#include "caffe2/utils/math.h"
3
4
namespace
caffe2
{
5
6
struct
ExpCPUFunctor
{
7
template
<
typename
T>
8
inline
void
9
operator()(
const
int
n,
const
T* x, T* y,
CPUContext
* device_context) {
10
math::Exp<T, CPUContext>(n, x, y, device_context);
11
}
12
};
13
14
REGISTER_CPU_OPERATOR(
15
Exp,
16
UnaryElementwiseOp
<
TensorTypes<float>
,
CPUContext
,
ExpCPUFunctor
>);
17
18
OPERATOR_SCHEMA(Exp)
19
.NumInputs(1)
20
.NumOutputs(1)
21
.AllowInplace({{0, 0}})
22
.IdenticalTypeAndShape()
23
.SetDoc(R
"DOC(
24
Calculates the exponential of the given input tensor, element-wise. This
25
operation can be done in an in-place fashion too, by providing the same input
26
and output blobs.
27
)DOC")
28
.Input(0,
"input"
,
"Input tensor"
)
29
.Output(
30
0,
31
"output"
,
32
"The exponential of the input tensor computed "
33
"element-wise"
)
34
.InheritOnnxSchema(
"Exp"
);
35
36
class
GetExpGradient
:
public
GradientMakerBase
{
37
using
GradientMakerBase::GradientMakerBase;
38
vector<OperatorDef> GetGradientDefs()
override
{
39
return
SingleGradientDef(
40
"Mul"
,
41
""
,
42
std::vector<string>{O(0), GO(0)},
43
std::vector<string>{GI(0)});
44
}
45
};
46
REGISTER_GRADIENT(Exp,
GetExpGradient
);
47
}
// namespace caffe2
caffe2::GradientMakerBase
Definition:
operator_gradient.h:47
caffe2::CPUContext
The CPU Context, representing the bare minimum of what a Context class in Caffe2 should implement...
Definition:
context.h:66
caffe2::ExpCPUFunctor
Definition:
exp_op.cc:6
caffe2
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition:
convert_encoded_to_raw_leveldb.cc:47
caffe2::TensorTypes
Definition:
operator.h:547
caffe2::UnaryElementwiseWithArgsOp
Definition:
elementwise_op.h:36
caffe2::GetExpGradient
Definition:
exp_op.cc:36
Generated on Thu Apr 19 2018 13:03:55 for Caffe2 - C++ API by
1.8.11