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

lrn_layer_forward.h
1 /* file: lrn_layer_forward.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 forward local response normalization layer
21 // in the batch processing mode
22 //--
23 */
24 
25 #ifndef __LRN_LAYER_FORWARD_H__
26 #define __LRN_LAYER_FORWARD_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/lrn/lrn_layer_types.h"
33 #include "algorithms/neural_networks/layers/lrn/lrn_layer_forward_types.h"
34 
35 namespace daal
36 {
37 namespace algorithms
38 {
39 namespace neural_networks
40 {
41 namespace layers
42 {
43 namespace lrn
44 {
45 namespace forward
46 {
47 namespace interface1
48 {
66 template<typename algorithmFPType, Method method, CpuType cpu>
67 class BatchContainer : public layers::forward::LayerContainerIfaceImpl
68 {
69 public:
76  DAAL_DEPRECATED BatchContainer(daal::services::Environment::env *daalEnv);
81  DAAL_DEPRECATED ~BatchContainer();
88  DAAL_DEPRECATED services::Status compute() DAAL_C11_OVERRIDE;
89 };
90 
111 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
112 class Batch : public layers::forward::LayerIfaceImpl
113 {
114 public:
115  typedef layers::forward::LayerIfaceImpl super;
116 
117  typedef algorithms::neural_networks::layers::lrn::forward::Input InputType;
118  typedef algorithms::neural_networks::layers::lrn::Parameter ParameterType;
119  typedef algorithms::neural_networks::layers::lrn::forward::Result ResultType;
120 
121  ParameterType &parameter;
122  InputType input;
128  DAAL_DEPRECATED Batch() : parameter(_defaultParameter)
129  {
130  initialize();
131  };
132 
133 
140  DAAL_DEPRECATED Batch(ParameterType& parameter) : parameter(parameter), _defaultParameter(parameter)
141  {
142  initialize();
143  }
144 
145 
153  DAAL_DEPRECATED Batch(const Batch<algorithmFPType, method> &other) : super(other),
154  _defaultParameter(other.parameter), parameter(_defaultParameter), input(other.input)
155  {
156  initialize();
157  }
158 
164  DAAL_DEPRECATED_VIRTUAL virtual int getMethod() const DAAL_C11_OVERRIDE { return(int) method; }
165 
171  DAAL_DEPRECATED_VIRTUAL virtual InputType *getLayerInput() DAAL_C11_OVERRIDE { return &input; }
172 
178  DAAL_DEPRECATED_VIRTUAL virtual ParameterType *getLayerParameter() DAAL_C11_OVERRIDE { return &parameter; };
179 
185  DAAL_DEPRECATED layers::forward::ResultPtr getLayerResult() DAAL_C11_OVERRIDE
186  {
187  return getResult();
188  }
189 
195  DAAL_DEPRECATED ResultPtr getResult()
196  {
197  return _result;
198  }
199 
207  DAAL_DEPRECATED services::Status setResult(const ResultPtr& result)
208  {
209  DAAL_CHECK(result, services::ErrorNullResult)
210  _result = result;
211  _res = _result.get();
212  return services::Status();
213  }
214 
222  DAAL_DEPRECATED services::SharedPtr<Batch<algorithmFPType, method> > clone() const
223  {
224  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
225  }
226 
233  DAAL_DEPRECATED_VIRTUAL virtual services::Status allocateResult() DAAL_C11_OVERRIDE
234  {
235  services::Status s = this->_result->template allocate<algorithmFPType>(&(this->input), &parameter, (int) method);
236  this->_res = this->_result.get();
237  return s;
238  }
239 
240 protected:
241  /*
242  * \DAAL_DEPRECATED
243  */
244  DAAL_DEPRECATED_VIRTUAL virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
245  {
246  return new Batch<algorithmFPType, method>(*this);
247  }
248  /*
249  * \DAAL_DEPRECATED
250  */
251  DAAL_DEPRECATED void initialize()
252  {
253  Analysis<batch>::_ac = new __DAAL_ALGORITHM_LAYER_CONTAINER(BatchContainer, algorithmFPType, method)(&_env);
254  _in = &input;
255  _par = &parameter;
256  _result.reset(new ResultType());
257  }
258 
259 private:
260  ResultPtr _result;
261  ParameterType _defaultParameter;
262 };
264 } // namespace interface1
265 using interface1::BatchContainer;
266 using interface1::Batch;
267 } // namespace forward
268 } // namespace lrn
269 } // namespace layers
270 } // namespace neural_networks
271 } // namespace algorithms
272 } // namespace daal
273 #endif
daal::algorithms::neural_networks::layers::lrn::forward::interface1::Batch::Batch
DAAL_DEPRECATED Batch(const Batch< algorithmFPType, method > &other)
Definition: lrn_layer_forward.h:153
daal::algorithms::neural_networks::layers::lrn::forward::interface1::Batch::getLayerResult
DAAL_DEPRECATED layers::forward::ResultPtr getLayerResult() DAAL_C11_OVERRIDE
Definition: lrn_layer_forward.h:185
daal::algorithms::neural_networks::layers::lrn::forward::interface1::Batch
Provides methods for the forward local response normalization layer in the batch processing mode...
Definition: lrn_layer_forward.h:112
daal::algorithms::neural_networks::layers::lrn::forward::interface1::Batch::clone
DAAL_DEPRECATED services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: lrn_layer_forward.h:222
daal::algorithms::neural_networks::layers::lrn::forward::interface1::Batch::getLayerParameter
virtual DAAL_DEPRECATED_VIRTUAL ParameterType * getLayerParameter() DAAL_C11_OVERRIDE
Definition: lrn_layer_forward.h:178
daal::algorithms::neural_networks::layers::lrn::forward::interface1::Batch::allocateResult
virtual DAAL_DEPRECATED_VIRTUAL services::Status allocateResult() DAAL_C11_OVERRIDE
Definition: lrn_layer_forward.h:233
daal::algorithms::neural_networks::layers::lrn::forward::interface1::Batch::getMethod
virtual DAAL_DEPRECATED_VIRTUAL int getMethod() const DAAL_C11_OVERRIDE
Definition: lrn_layer_forward.h:164
daal::services::ErrorNullResult
Definition: error_indexes.h:98
daal::algorithms::neural_networks::layers::lrn::forward::interface1::BatchContainer::compute
DAAL_DEPRECATED services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::neural_networks::layers::lrn::forward::interface1::BatchContainer
Provides methods to run implementations of the of the forward local response normalization layer This...
Definition: lrn_layer_forward.h:67
daal::algorithms::neural_networks::layers::lrn::forward::interface1::Batch::getResult
DAAL_DEPRECATED ResultPtr getResult()
Definition: lrn_layer_forward.h:195
daal_defines.h
daal::algorithms::neural_networks::layers::lrn::forward::interface1::Batch::Batch
DAAL_DEPRECATED Batch(ParameterType &parameter)
Definition: lrn_layer_forward.h:140
daal::algorithms::neural_networks::layers::lrn::forward::interface1::Batch::parameter
ParameterType & parameter
Definition: lrn_layer_forward.h:121
daal::algorithms::neural_networks::layers::lrn::forward::interface1::BatchContainer::BatchContainer
DAAL_DEPRECATED BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::neural_networks::layers::lrn::forward::interface1::Batch::getLayerInput
virtual DAAL_DEPRECATED_VIRTUAL InputType * getLayerInput() DAAL_C11_OVERRIDE
Definition: lrn_layer_forward.h:171
daal::algorithms::neural_networks::layers::lrn::forward::interface1::Batch::Batch
DAAL_DEPRECATED Batch()
Definition: lrn_layer_forward.h:128
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::lrn::forward::interface1::Batch::input
InputType input
Definition: lrn_layer_forward.h:122
daal::algorithms::neural_networks::layers::lrn::forward::interface1::BatchContainer::~BatchContainer
DAAL_DEPRECATED ~BatchContainer()
daal::algorithms::neural_networks::layers::lrn::forward::interface1::Batch::setResult
DAAL_DEPRECATED services::Status setResult(const ResultPtr &result)
Definition: lrn_layer_forward.h:207

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