Caffe2 - C++ API
A deep learning, cross platform ML framework
elu_op.h
1 
17 #pragma once
18 
19 #include "caffe2/core/context.h"
20 #include "caffe2/core/logging.h"
21 #include "caffe2/core/operator.h"
22 
23 namespace caffe2 {
24 
25 template <typename T, class Context>
26 class EluOp final : public Operator<Context> {
27  public:
28  EluOp(const OperatorDef& operator_def, Workspace* ws)
29  : Operator<Context>(operator_def, ws),
30  alpha_(OperatorBase::GetSingleArgument<float>("alpha", 1.0)) {}
31  USE_OPERATOR_CONTEXT_FUNCTIONS;
32 
33  bool RunOnDevice() override;
34 
35  protected:
36  T alpha_;
37 };
38 
39 template <typename T, class Context>
40 class EluGradientOp final : public Operator<Context> {
41  public:
42  EluGradientOp(const OperatorDef& operator_def, Workspace* ws)
43  : Operator<Context>(operator_def, ws),
44  alpha_(OperatorBase::GetSingleArgument<float>("alpha", 1.0)) {}
45  USE_OPERATOR_CONTEXT_FUNCTIONS;
46 
47  bool RunOnDevice() override;
48 
49  protected:
50  T alpha_;
51 };
52 
53 } // namespace caffe2
Workspace is a class that holds all the related objects created during runtime: (1) all blobs...
Definition: workspace.h:63
Copyright (c) 2016-present, Facebook, Inc.