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
log_op.cc
1
#include "caffe2/operators/math_ops.h"
2
#include "caffe2/utils/math.h"
3
4
5
namespace
caffe2
{
6
7
struct
LogCPUFunctor
{
8
template
<
typename
T>
9
inline
void
10
operator()(
const
int
n,
const
T* x, T* y,
CPUContext
* device_context) {
11
math::Log<T, CPUContext>(n, x, y, device_context);
12
}
13
};
14
15
REGISTER_CPU_OPERATOR(
16
Log,
17
UnaryElementwiseOp
<
TensorTypes<float>
,
CPUContext
,
LogCPUFunctor
>);
18
19
OPERATOR_SCHEMA(Log)
20
.NumInputs(1)
21
.NumOutputs(1)
22
.AllowInplace({{0, 0}})
23
.IdenticalTypeAndShape()
24
.SetDoc(R
"DOC(
25
Calculates the natural log of the given input tensor, element-wise. This
26
operation can be done in an in-place fashion too, by providing the same input
27
and output blobs.
28
)DOC")
29
.Input(0,
"input"
,
"Input tensor"
)
30
.Output(
31
0,
32
"output"
,
33
"The natural log of the input tensor computed "
34
"element-wise"
)
35
.InheritOnnxSchema(
"Log"
);
36
37
class
GetLogGradient
:
public
GradientMakerBase
{
38
using
GradientMakerBase::GradientMakerBase;
39
vector<OperatorDef> GetGradientDefs()
override
{
40
return
SingleGradientDef(
41
"Div"
,
42
""
,
43
std::vector<string>{GO(0), I(0)},
44
std::vector<string>{GI(0)});
45
}
46
};
47
REGISTER_GRADIENT(Log,
GetLogGradient
);
48
49
}
// 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
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::LogCPUFunctor
Definition:
log_op.cc:7
caffe2::GetLogGradient
Definition:
log_op.cc:37
Generated on Thu Apr 19 2018 13:03:55 for Caffe2 - C++ API by
1.8.11