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

maximum_pooling3d_layer_backward.h
1 /* file: maximum_pooling3d_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 maximum three-dimensional (3D) pooling layer
21 // in the batch processing mode
22 //--
23 */
24 
25 #ifndef __MAXIMUM_POOLING3D_LAYER_BACKWARD_H__
26 #define __MAXIMUM_POOLING3D_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/pooling3d/maximum_pooling3d_layer_types.h"
33 #include "algorithms/neural_networks/layers/pooling3d/maximum_pooling3d_layer_backward_types.h"
34 
35 namespace daal
36 {
37 namespace algorithms
38 {
39 namespace neural_networks
40 {
41 namespace layers
42 {
43 namespace maximum_pooling3d
44 {
45 namespace backward
46 {
50 namespace interface1
51 {
69 template<typename algorithmFPType, Method method, CpuType cpu>
70 class BatchContainer : public AnalysisContainerIface<batch>
71 {
72 public:
79  DAAL_DEPRECATED BatchContainer(daal::services::Environment::env *daalEnv);
84  DAAL_DEPRECATED ~BatchContainer();
91  DAAL_DEPRECATED services::Status compute() DAAL_C11_OVERRIDE;
92 };
93 
114 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
115 class Batch : public layers::backward::LayerIfaceImpl
116 {
117 public:
118  typedef layers::backward::LayerIfaceImpl super;
119 
120  typedef algorithms::neural_networks::layers::maximum_pooling3d::backward::Input InputType;
121  typedef algorithms::neural_networks::layers::maximum_pooling3d::Parameter ParameterType;
122  typedef algorithms::neural_networks::layers::maximum_pooling3d::backward::Result ResultType;
123 
124  ParameterType &parameter;
125  InputType input;
132  DAAL_DEPRECATED Batch(size_t nDimensions) : _defaultParameter(nDimensions - 3, nDimensions - 2, nDimensions - 1), parameter(_defaultParameter)
133  {
134  initialize();
135  }
136 
143  DAAL_DEPRECATED Batch(ParameterType& parameter) : parameter(parameter), _defaultParameter(parameter)
144  {
145  initialize();
146  }
147 
155  Batch(const Batch<algorithmFPType, method> &other) : super(other),
156  _defaultParameter(other.parameter), parameter(_defaultParameter), input(other.input)
157  {
158  initialize();
159  }
160 
166  DAAL_DEPRECATED_VIRTUAL virtual int getMethod() const DAAL_C11_OVERRIDE { return(int) method; }
167 
173  DAAL_DEPRECATED_VIRTUAL virtual InputType *getLayerInput() DAAL_C11_OVERRIDE { return &input; }
174 
180  DAAL_DEPRECATED_VIRTUAL virtual ParameterType *getLayerParameter() DAAL_C11_OVERRIDE { return &parameter; };
181 
187  DAAL_DEPRECATED layers::backward::ResultPtr getLayerResult() DAAL_C11_OVERRIDE
188  {
189  return _result;
190  }
191 
197  DAAL_DEPRECATED ResultPtr getResult()
198  {
199  return _result;
200  }
201 
209  DAAL_DEPRECATED services::Status setResult(const ResultPtr& result)
210  {
211  DAAL_CHECK(result, services::ErrorNullResult)
212  _result = result;
213  _res = _result.get();
214  return services::Status();
215  }
216 
224  DAAL_DEPRECATED services::SharedPtr<Batch<algorithmFPType, method> > clone() const
225  {
226  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
227  }
228 
235  DAAL_DEPRECATED_VIRTUAL virtual services::Status allocateResult() DAAL_C11_OVERRIDE
236  {
237  services::Status s = this->_result->template allocate<algorithmFPType>(&(this->input), &parameter, (int) method);
238  this->_res = this->_result.get();
239  return s;
240  }
241 
242 protected:
243  /*
244  * \DAAL_DEPRECATED
245  */
246  DAAL_DEPRECATED_VIRTUAL virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
247  {
248  return new Batch<algorithmFPType, method>(*this);
249  }
250 
251  /*
252  * \DAAL_DEPRECATED
253  */
254  void initialize()
255  {
256  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
257  _in = &input;
258  _par = &parameter;
259  _result.reset(new ResultType());
260  }
261 
262 private:
263  ResultPtr _result;
264  ParameterType _defaultParameter;
265 };
267 } // namespace interface1
268 using interface1::BatchContainer;
269 using interface1::Batch;
270 } // namespace backward
271 } // namespace maximum_pooling3d
272 } // namespace layers
273 } // namespace neural_networks
274 } // namespace algorithms
275 } // namespace daal
276 
277 #endif
daal::algorithms::neural_networks::layers::maximum_pooling3d::backward::interface1::Batch::getLayerResult
DAAL_DEPRECATED layers::backward::ResultPtr getLayerResult() DAAL_C11_OVERRIDE
Definition: maximum_pooling3d_layer_backward.h:187
daal::batch
Definition: daal_defines.h:112
daal::algorithms::neural_networks::layers::maximum_pooling3d::backward::interface1::Batch::setResult
DAAL_DEPRECATED services::Status setResult(const ResultPtr &result)
Definition: maximum_pooling3d_layer_backward.h:209
daal::algorithms::neural_networks::layers::maximum_pooling3d::backward::interface1::Batch
Provides methods for the backward maximum 3D pooling layer in the batch processing mode...
Definition: maximum_pooling3d_layer_backward.h:115
daal::algorithms::neural_networks::layers::maximum_pooling3d::backward::interface1::Batch::getLayerInput
virtual DAAL_DEPRECATED_VIRTUAL InputType * getLayerInput() DAAL_C11_OVERRIDE
Definition: maximum_pooling3d_layer_backward.h:173
daal::algorithms::neural_networks::layers::maximum_pooling3d::backward::interface1::BatchContainer::~BatchContainer
DAAL_DEPRECATED ~BatchContainer()
daal::algorithms::neural_networks::layers::maximum_pooling3d::backward::interface1::BatchContainer::BatchContainer
DAAL_DEPRECATED BatchContainer(daal::services::Environment::env *daalEnv)
daal::services::ErrorNullResult
Definition: error_indexes.h:98
daal::algorithms::neural_networks::layers::maximum_pooling3d::backward::interface1::BatchContainer
Provides methods to run implementations of the backward maximum 3D pooling layer. This class is assoc...
Definition: maximum_pooling3d_layer_backward.h:70
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::maximum_pooling3d::backward::interface1::Batch::input
InputType input
Definition: maximum_pooling3d_layer_backward.h:125
daal_defines.h
daal::algorithms::neural_networks::layers::maximum_pooling3d::backward::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: maximum_pooling3d_layer_backward.h:155
daal::algorithms::neural_networks::layers::maximum_pooling3d::backward::interface1::Batch::parameter
ParameterType & parameter
Definition: maximum_pooling3d_layer_backward.h:124
daal::algorithms::neural_networks::layers::maximum_pooling3d::backward::interface1::Batch::clone
DAAL_DEPRECATED services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: maximum_pooling3d_layer_backward.h:224
daal::algorithms::neural_networks::layers::maximum_pooling3d::backward::interface1::Batch::getMethod
virtual DAAL_DEPRECATED_VIRTUAL int getMethod() const DAAL_C11_OVERRIDE
Definition: maximum_pooling3d_layer_backward.h:166
daal::algorithms::neural_networks::layers::maximum_pooling3d::backward::interface1::Batch::Batch
DAAL_DEPRECATED Batch(ParameterType &parameter)
Definition: maximum_pooling3d_layer_backward.h:143
daal::algorithms::neural_networks::layers::maximum_pooling3d::backward::interface1::Batch::getResult
DAAL_DEPRECATED ResultPtr getResult()
Definition: maximum_pooling3d_layer_backward.h:197
daal::algorithms::neural_networks::layers::maximum_pooling3d::backward::interface1::Batch::getLayerParameter
virtual DAAL_DEPRECATED_VIRTUAL ParameterType * getLayerParameter() DAAL_C11_OVERRIDE
Definition: maximum_pooling3d_layer_backward.h:180
daal::algorithms::neural_networks::layers::maximum_pooling3d::backward::interface1::BatchContainer::compute
DAAL_DEPRECATED services::Status compute() DAAL_C11_OVERRIDE
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::maximum_pooling3d::backward::interface1::Batch::allocateResult
virtual DAAL_DEPRECATED_VIRTUAL services::Status allocateResult() DAAL_C11_OVERRIDE
Definition: maximum_pooling3d_layer_backward.h:235
daal::algorithms::neural_networks::layers::maximum_pooling3d::backward::interface1::Batch::Batch
DAAL_DEPRECATED Batch(size_t nDimensions)
Definition: maximum_pooling3d_layer_backward.h:132

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