2 #include <dlprim/operator.hpp> 6 namespace gpu {
class GEMM; }
7 namespace core {
class Conv2DForward;
class Conv2DBackwardData;
class Conv2DBackwardFilter; }
14 std::string fwd_algo=
"auto";
15 std::string bwd_data_algo=
"auto";
16 std::string bwd_filter_algo=
"auto";
24 template<
typename Op,
typename DType>
27 static void scale_cpu(
Tensor &t,
float v);
38 return "Convolution2D";
41 void initialize_params(std::vector<Tensor> ¶meters,
ExecutionContext const &e);
43 virtual void setup(std::vector<TensorSpecs>
const &in,
44 std::vector<TensorSpecs> &out,
45 std::vector<TensorSpecs> ¶meters,
48 virtual void reshape(std::vector<Shape>
const &in,
49 std::vector<Shape> &out,
52 virtual void forward(std::vector<Tensor> &input,
53 std::vector<Tensor> &output,
54 std::vector<Tensor> ¶meters,
58 virtual void backward(std::vector<TensorAndGradient> &input,
59 std::vector<TensorAndGradient> &output,
60 std::vector<TensorAndGradient> ¶meters,
68 size_t calc_workspace(
Shape const &in);
69 void setup_algo(
Shape const &in);
70 int get_im2col_width();
82 std::unique_ptr<core::Conv2DForward> conv_;
83 std::unique_ptr<core::Conv2DBackwardData> conv_bwd_data_;
84 std::unique_ptr<core::Conv2DBackwardFilter> conv_bwd_filter_;
86 std::unique_ptr<Operator> activation_;
87 std::unique_ptr<BWBias> bwd_bias_;
96 int output_pad[2] = {0,0};
109 return "TransposedConvolution2D";
112 void initialize_params(std::vector<Tensor> ¶meters,
ExecutionContext const &e);
114 virtual void setup(std::vector<TensorSpecs>
const &in,
115 std::vector<TensorSpecs> &out,
116 std::vector<TensorSpecs> ¶meters,
119 virtual void reshape(std::vector<Shape>
const &in,
120 std::vector<Shape> &out,
123 virtual void forward(std::vector<Tensor> &input,
124 std::vector<Tensor> &output,
125 std::vector<Tensor> ¶meters,
129 virtual void backward(std::vector<TensorAndGradient> &input,
130 std::vector<TensorAndGradient> &output,
131 std::vector<TensorAndGradient> ¶meters,
139 size_t calc_workspace(
Shape const &in);
140 void setup_algo(
Shape const &in);
141 int get_im2col_width();
155 std::unique_ptr<core::Conv2DForward> conv_bwd_data_;
156 std::unique_ptr<core::Conv2DBackwardData> conv_fwd_;
157 std::unique_ptr<core::Conv2DBackwardFilter> conv_bwd_filter_;
159 std::unique_ptr<Operator> activation_;
160 std::unique_ptr<BWBias> bwd_bias_;
162 size_t out_h_,out_w_;
Definition: conv2d.hpp:95
Tensor shape.
Definition: shape.hpp:18
Definition: conv2d.hpp:30
Definition: conv2d.hpp:101
Definition: conv2d.hpp:11
Convolution settings.
Definition: definitions.hpp:301
Base class for backward/forward propogation calculations for internal network.
Definition: operator.hpp:15
This is main object that represent the pair of OpenCL platform and device all other objects use it...
Definition: context.hpp:302
DataType
type definition
Definition: definitions.hpp:70
virtual char const * operator_type() const
name of the operator type
Definition: conv2d.hpp:107
virtual char const * operator_type() const
name of the operator type
Definition: conv2d.hpp:36
This class is central representation of json objects.
Definition: json.hpp:652
Mane namespace.
Definition: context.hpp:9
Central Data Contrainer - Tensor.
Definition: tensor.hpp:99
GemmOpMode
internal GEMM mode
Definition: definitions.hpp:292
StandardActivations
Parameterless Activations that can be embedded to general kernels like inner product or convolution...
Definition: definitions.hpp:266
Definition: conv2d.hpp:22
This class is used to pass cl::Events that the kernel should wait for and/or signal event completion...
Definition: context.hpp:121