C++ API Reference for Intel® Data Analytics Acceleration Library 2020 Update 1

transposed_conv2d_layer_backward.h
1 /* file: transposed_conv2d_layer_backward.h */
2 /*******************************************************************************
3 * Copyright 2014-2020 Intel Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
17 
18 /*
19 //++
20 // Implementation of the interface for the backward two-dimensional (2D) transposed convolution layer in the
21 // batch processing mode
22 //--
23 */
24 
25 #ifndef __TRANSPOSED_CONV2D_LAYER_BACKWARD_H__
26 #define __TRANSPOSED_CONV2D_LAYER_BACKWARD_H__
27 
28 #include "algorithms/algorithm.h"
29 #include "data_management/data/tensor.h"
30 #include "services/daal_defines.h"
31 #include "algorithms/neural_networks/layers/layer.h"
32 #include "algorithms/neural_networks/layers/transposed_conv2d/transposed_conv2d_layer_types.h"
33 #include "algorithms/neural_networks/layers/transposed_conv2d/transposed_conv2d_layer_backward_types.h"
34 
35 namespace daal
36 {
37 namespace algorithms
38 {
39 namespace neural_networks
40 {
41 namespace layers
42 {
43 namespace transposed_conv2d
44 {
45 namespace backward
46 {
47 namespace interface1
48 {
66 template<typename algorithmFPType, Method method, CpuType cpu>
67 class BatchContainer : public AnalysisContainerIface<batch>
68 {
69 public:
76  DAAL_DEPRECATED BatchContainer(daal::services::Environment::env *daalEnv);
81  DAAL_DEPRECATED ~BatchContainer();
87  services::Status compute() DAAL_C11_OVERRIDE;
88  services::Status setupCompute() DAAL_C11_OVERRIDE;
89  services::Status resetCompute() DAAL_C11_OVERRIDE;
90 };
91 
111 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
112 class Batch : public layers::backward::LayerIfaceImpl
113 {
114 public:
115  typedef layers::backward::LayerIfaceImpl super;
116 
117  typedef algorithms::neural_networks::layers::transposed_conv2d::backward::Input InputType;
118  typedef algorithms::neural_networks::layers::transposed_conv2d::Parameter ParameterType;
119  typedef algorithms::neural_networks::layers::transposed_conv2d::backward::Result ResultType;
120 
121  ParameterType &parameter;
122  InputType input;
128  DAAL_DEPRECATED Batch() : parameter(_defaultParameter)
129  {
130  initialize();
131  };
132 
139  DAAL_DEPRECATED Batch(ParameterType& parameter) : parameter(parameter), _defaultParameter(parameter)
140  {
141  initialize();
142  }
143 
150  Batch(const Batch<algorithmFPType, method> &other) : super(other),
151  _defaultParameter(other.parameter), parameter(_defaultParameter), input(other.input)
152  {
153  initialize();
154  }
155 
160  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int) method; }
161 
166  virtual InputType *getLayerInput() DAAL_C11_OVERRIDE { return &input; }
167 
172  virtual ParameterType *getLayerParameter() DAAL_C11_OVERRIDE { return &parameter; };
173 
178  layers::backward::ResultPtr getLayerResult() DAAL_C11_OVERRIDE
179  {
180  return getResult();
181  }
182 
187  ResultPtr getResult()
188  {
189  return _result;
190  }
191 
198  services::Status setResult(const ResultPtr& result)
199  {
200  DAAL_CHECK(result, services::ErrorNullResult)
201  _result = result;
202  _res = _result.get();
203  return services::Status();
204  }
205 
211  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
212  {
213  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
214  }
215 
216  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
217  {
218  services::Status s = this->_result->template allocate<algorithmFPType>(&(this->input), &parameter, (int) method);
219  this->_res = this->_result.get();
220  return s;
221  }
222 
223 protected:
224  virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
225  {
226  return new Batch<algorithmFPType, method>(*this);
227  }
228 
229  void initialize()
230  {
231  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
232  _in = &input;
233  _par = &parameter;
234  _result.reset(new ResultType());
235  }
236 
237 private:
238  ResultPtr _result;
239  ParameterType _defaultParameter;
240 };
242 } // namespace interface1
243 using interface1::BatchContainer;
244 using interface1::Batch;
245 } // namespace backward
246 } // namespace transposed_conv2d
247 } // namespace layers
248 } // namespace neural_networks
249 } // namespace algorithms
250 } // namespace daal
251 #endif
daal::algorithms::neural_networks::layers::transposed_conv2d::backward::interface1::Batch::getResult
ResultPtr getResult()
Definition: transposed_conv2d_layer_backward.h:187
daal::algorithms::neural_networks::layers::transposed_conv2d::backward::interface1::BatchContainer::compute
services::Status compute() DAAL_C11_OVERRIDE
daal::batch
Definition: daal_defines.h:112
daal::algorithms::neural_networks::layers::transposed_conv2d::backward::interface1::Batch::getLayerParameter
virtual ParameterType * getLayerParameter() DAAL_C11_OVERRIDE
Definition: transposed_conv2d_layer_backward.h:172
daal::algorithms::neural_networks::layers::transposed_conv2d::backward::interface1::BatchContainer
Provides methods to run implementations of the of the backward 2D transposed convolution layer This c...
Definition: transposed_conv2d_layer_backward.h:67
daal::algorithms::neural_networks::layers::transposed_conv2d::backward::interface1::Batch::input
InputType input
Definition: transposed_conv2d_layer_backward.h:122
daal::algorithms::neural_networks::layers::transposed_conv2d::backward::interface1::BatchContainer::BatchContainer
DAAL_DEPRECATED BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::neural_networks::layers::transposed_conv2d::backward::interface1::Batch::setResult
services::Status setResult(const ResultPtr &result)
Definition: transposed_conv2d_layer_backward.h:198
daal::algorithms::neural_networks::layers::transposed_conv2d::backward::interface1::BatchContainer::~BatchContainer
DAAL_DEPRECATED ~BatchContainer()
daal::algorithms::neural_networks::layers::transposed_conv2d::backward::interface1::Batch::Batch
DAAL_DEPRECATED Batch(ParameterType &parameter)
Definition: transposed_conv2d_layer_backward.h:139
daal::algorithms::neural_networks::layers::transposed_conv2d::backward::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: transposed_conv2d_layer_backward.h:150
daal::services::ErrorNullResult
Definition: error_indexes.h:98
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:55
daal::algorithms::neural_networks::layers::transposed_conv2d::backward::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: transposed_conv2d_layer_backward.h:211
daal_defines.h
daal::algorithms::neural_networks::layers::transposed_conv2d::backward::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: transposed_conv2d_layer_backward.h:160
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:70
daal::algorithms::neural_networks::layers::transposed_conv2d::backward::interface1::Batch::getLayerInput
virtual InputType * getLayerInput() DAAL_C11_OVERRIDE
Definition: transposed_conv2d_layer_backward.h:166
daal::algorithms::neural_networks::layers::transposed_conv2d::backward::interface1::Batch::parameter
ParameterType & parameter
Definition: transposed_conv2d_layer_backward.h:121
daal::algorithms::neural_networks::layers::transposed_conv2d::backward::interface1::Batch::getLayerResult
layers::backward::ResultPtr getLayerResult() DAAL_C11_OVERRIDE
Definition: transposed_conv2d_layer_backward.h:178
daal::algorithms::neural_networks::layers::transposed_conv2d::backward::interface1::Batch::Batch
DAAL_DEPRECATED Batch()
Definition: transposed_conv2d_layer_backward.h:128
daal::algorithms::neural_networks::layers::transposed_conv2d::backward::interface1::Batch
Provides methods for backward 2D transposed convolution layer computations in the batch processing mo...
Definition: transposed_conv2d_layer_backward.h:112

For more complete information about compiler optimizations, see our Optimization Notice.