Caffe2 - C++ API
A deep learning, cross platform ML framework
prelu_op.h
1 #pragma once
2 
3 #include "caffe2/core/context.h"
4 #include "caffe2/core/logging.h"
5 #include "caffe2/core/operator.h"
6 #include "caffe2/utils/math.h"
7 
8 namespace caffe2 {
9 
10 template <typename T, class Context>
11 class PReluOp final : public Operator<Context> {
12  public:
13  PReluOp(const OperatorDef& operator_def, Workspace* ws)
14  : Operator<Context>(operator_def, ws),
15  order_(StringToStorageOrder(
16  OperatorBase::GetSingleArgument<string>("order", "NCHW"))) {}
17 
18  USE_OPERATOR_CONTEXT_FUNCTIONS;
19 
20  bool RunOnDevice() override;
21 
22  protected:
23  StorageOrder order_;
24 };
25 
26 template <typename T, class Context>
27 class PReluGradientOp final : public Operator<Context> {
28  public:
29  PReluGradientOp(const OperatorDef& operator_def, Workspace* ws)
30  : Operator<Context>(operator_def, ws),
31  order_(StringToStorageOrder(
32  OperatorBase::GetSingleArgument<string>("order", "NCHW"))) {}
33  USE_OPERATOR_CONTEXT_FUNCTIONS;
34 
35  bool RunOnDevice() override;
36 
37  protected:
38  StorageOrder order_;
39 };
40 
41 } // namespace caffe2
Workspace is a class that holds all the related objects created during runtime: (1) all blobs...
Definition: workspace.h:47
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...