C++ API Reference for Intel® Data Analytics Acceleration Library 2019 Update 4

maximum_pooling1d_layer_backward.h
1 /* file: maximum_pooling1d_layer_backward.h */
2 /*******************************************************************************
3 * Copyright 2014-2019 Intel Corporation.
4 *
5 * This software and the related documents are Intel copyrighted materials, and
6 * your use of them is governed by the express license under which they were
7 * provided to you (License). Unless the License provides otherwise, you may not
8 * use, modify, copy, publish, distribute, disclose or transmit this software or
9 * the related documents without Intel's prior written permission.
10 *
11 * This software and the related documents are provided as is, with no express
12 * or implied warranties, other than those that are expressly stated in the
13 * License.
14 *******************************************************************************/
15 
16 /*
17 //++
18 // Implementation of the interface for the backward maximum one-dimensional (1D) pooling layer
19 // in the batch processing mode
20 //--
21 */
22 
23 #ifndef __MAXIMUM_POOLING1D_LAYER_BACKWARD_H__
24 #define __MAXIMUM_POOLING1D_LAYER_BACKWARD_H__
25 
26 #include "algorithms/algorithm.h"
27 #include "data_management/data/tensor.h"
28 #include "services/daal_defines.h"
29 #include "algorithms/neural_networks/layers/layer.h"
30 #include "algorithms/neural_networks/layers/pooling1d/maximum_pooling1d_layer_types.h"
31 #include "algorithms/neural_networks/layers/pooling1d/maximum_pooling1d_layer_backward_types.h"
32 
33 namespace daal
34 {
35 namespace algorithms
36 {
37 namespace neural_networks
38 {
39 namespace layers
40 {
41 namespace maximum_pooling1d
42 {
43 namespace backward
44 {
48 namespace interface1
49 {
65 template<typename algorithmFPType, Method method, CpuType cpu>
66 class DAAL_EXPORT BatchContainer : public AnalysisContainerIface<batch>
67 {
68 public:
74  BatchContainer(daal::services::Environment::env *daalEnv);
76  ~BatchContainer();
82  services::Status compute() DAAL_C11_OVERRIDE;
83 };
84 
103 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
104 class Batch : public layers::backward::LayerIfaceImpl
105 {
106 public:
107  typedef layers::backward::LayerIfaceImpl super;
108 
109  typedef algorithms::neural_networks::layers::maximum_pooling1d::backward::Input InputType;
110  typedef algorithms::neural_networks::layers::maximum_pooling1d::Parameter ParameterType;
111  typedef algorithms::neural_networks::layers::maximum_pooling1d::backward::Result ResultType;
112 
113  ParameterType &parameter;
114  InputType input;
120  Batch(size_t nDimensions) : _defaultParameter(nDimensions-1), parameter(_defaultParameter)
121  {
122  initialize();
123  }
124 
130  Batch(ParameterType& parameter) : parameter(parameter), _defaultParameter(parameter)
131  {
132  initialize();
133  }
134 
141  Batch(const Batch<algorithmFPType, method> &other) : super(other),
142  _defaultParameter(other.parameter), parameter(_defaultParameter), input(other.input)
143  {
144  initialize();
145  }
146 
151  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int) method; }
152 
157  virtual InputType *getLayerInput() DAAL_C11_OVERRIDE { return &input; }
158 
163  virtual ParameterType *getLayerParameter() DAAL_C11_OVERRIDE { return &parameter; };
164 
169  layers::backward::ResultPtr getLayerResult() DAAL_C11_OVERRIDE
170  {
171  return _result;
172  }
173 
178  ResultPtr getResult()
179  {
180  return _result;
181  }
182 
189  services::Status setResult(const ResultPtr& result)
190  {
191  DAAL_CHECK(result, services::ErrorNullResult)
192  _result = result;
193  _res = _result.get();
194  return services::Status();
195  }
196 
203  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
204  {
205  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
206  }
207 
213  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
214  {
215  services::Status s = this->_result->template allocate<algorithmFPType>(&(this->input), &parameter, (int) method);
216  this->_res = this->_result.get();
217  return s;
218  }
219 
220 protected:
221  virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
222  {
223  return new Batch<algorithmFPType, method>(*this);
224  }
225 
226  void initialize()
227  {
228  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
229  _in = &input;
230  _par = &parameter;
231  _result.reset(new ResultType());
232  }
233 
234 private:
235  ResultPtr _result;
236  ParameterType _defaultParameter;
237 };
239 } // namespace interface1
240 using interface1::BatchContainer;
241 using interface1::Batch;
242 } // namespace backward
243 } // namespace maximum_pooling1d
244 } // namespace layers
245 } // namespace neural_networks
246 } // namespace algorithms
247 } // namespace daal
248 #endif
daal::algorithms::neural_networks::layers::maximum_pooling1d::backward::interface1::Batch
Provides methods for the backward maximum 1D pooling layer in the batch processing mode...
Definition: maximum_pooling1d_layer_backward.h:104
daal::algorithms::neural_networks::layers::maximum_pooling1d::backward::interface1::Batch::Batch
Batch(size_t nDimensions)
Definition: maximum_pooling1d_layer_backward.h:120
daal::algorithms::neural_networks::layers::maximum_pooling1d::backward::interface1::Batch::getLayerInput
virtual InputType * getLayerInput() DAAL_C11_OVERRIDE
Definition: maximum_pooling1d_layer_backward.h:157
daal
Definition: algorithm_base_common.h:31
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:53
daal::algorithms::neural_networks::layers::maximum_pooling1d::backward::interface1::BatchContainer
Provides methods to run implementations of the backward maximum 1D pooling layer. This class is assoc...
Definition: maximum_pooling1d_layer_backward.h:66
daal_defines.h
daal::algorithms::neural_networks::layers::maximum_pooling1d::backward::interface1::Batch::input
InputType input
Definition: maximum_pooling1d_layer_backward.h:114
daal::batch
Definition: daal_defines.h:110
daal::algorithms::neural_networks::layers::maximum_pooling1d::backward::interface1::Batch::Batch
Batch(ParameterType &parameter)
Definition: maximum_pooling1d_layer_backward.h:130
daal::algorithms::neural_networks::layers::maximum_pooling1d::backward::interface1::Batch::parameter
ParameterType & parameter
Definition: maximum_pooling1d_layer_backward.h:113
daal::algorithms::neural_networks::layers::maximum_pooling1d::backward::interface1::Batch::allocateResult
virtual services::Status allocateResult() DAAL_C11_OVERRIDE
Definition: maximum_pooling1d_layer_backward.h:213
daal::algorithms::neural_networks::layers::maximum_pooling1d::backward::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: maximum_pooling1d_layer_backward.h:141
daal::algorithms::neural_networks::layers::maximum_pooling1d::backward::interface1::Batch::setResult
services::Status setResult(const ResultPtr &result)
Definition: maximum_pooling1d_layer_backward.h:189
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::algorithms::neural_networks::layers::maximum_pooling1d::backward::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: maximum_pooling1d_layer_backward.h:203
daal::algorithms::neural_networks::layers::maximum_pooling1d::backward::interface1::Batch::getLayerParameter
virtual ParameterType * getLayerParameter() DAAL_C11_OVERRIDE
Definition: maximum_pooling1d_layer_backward.h:163
daal::algorithms::neural_networks::layers::maximum_pooling1d::backward::interface1::Batch::getResult
ResultPtr getResult()
Definition: maximum_pooling1d_layer_backward.h:178
daal::services::ErrorNullResult
Definition: error_indexes.h:96
daal::algorithms::neural_networks::layers::maximum_pooling1d::backward::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: maximum_pooling1d_layer_backward.h:151
daal::algorithms::neural_networks::layers::maximum_pooling1d::backward::interface1::Batch::getLayerResult
layers::backward::ResultPtr getLayerResult() DAAL_C11_OVERRIDE
Definition: maximum_pooling1d_layer_backward.h:169

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