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

split_layer_forward.h
1 /* file: split_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 split layer in the batch
21 // processing mode
22 //--
23 */
24 
25 #ifndef __SPLIT_LAYER_FORWARD_H__
26 #define __SPLIT_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/split/split_layer_types.h"
33 #include "algorithms/neural_networks/layers/split/split_layer_forward_types.h"
34 
35 namespace daal
36 {
37 namespace algorithms
38 {
39 namespace neural_networks
40 {
41 namespace layers
42 {
46 namespace split
47 {
51 namespace forward
52 {
53 namespace interface1
54 {
72 template<typename algorithmFPType, Method method, CpuType cpu>
73 class BatchContainer : public layers::forward::LayerContainerIfaceImpl
74 {
75 public:
82  DAAL_DEPRECATED BatchContainer(daal::services::Environment::env *daalEnv);
87  DAAL_DEPRECATED ~BatchContainer();
94  DAAL_DEPRECATED services::Status compute() DAAL_C11_OVERRIDE;
95 };
96 
116 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
117 class Batch : public layers::forward::LayerIfaceImpl
118 {
119 public:
120  typedef layers::forward::LayerIfaceImpl super;
121 
122  typedef algorithms::neural_networks::layers::split::forward::Input InputType;
123  typedef algorithms::neural_networks::layers::split::Parameter ParameterType;
124  typedef algorithms::neural_networks::layers::split::forward::Result ResultType;
125 
126  ParameterType &parameter;
127  InputType input;
133  DAAL_DEPRECATED Batch() : parameter(_defaultParameter)
134  {
135  initialize();
136  };
137 
144  DAAL_DEPRECATED Batch(ParameterType& parameter) : parameter(parameter), _defaultParameter(parameter)
145  {
146  initialize();
147  }
148 
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::forward::ResultPtr getLayerResult() DAAL_C11_OVERRIDE
188  {
189  return getResult();
190  }
191 
197  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 
223  DAAL_DEPRECATED services::SharedPtr<Batch<algorithmFPType, method> > clone() const
224  {
225  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
226  }
227 
234  DAAL_DEPRECATED_VIRTUAL virtual services::Status allocateResult() DAAL_C11_OVERRIDE
235  {
236  services::Status s = this->_result->template allocate<algorithmFPType>(&(this->input), &parameter, (int) method);
237  this->_res = this->_result.get();
238  return s;
239  }
240 
241 protected:
242  /*
243  * \DAAL_DEPRECATED
244  */
245  DAAL_DEPRECATED_VIRTUAL virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
246  {
247  return new Batch<algorithmFPType, method>(*this);
248  }
249 
250  /*
251  * \DAAL_DEPRECATED
252  */
253  void initialize()
254  {
255  Analysis<batch>::_ac = new __DAAL_ALGORITHM_LAYER_CONTAINER(BatchContainer, algorithmFPType, method)(&_env);
256  _in = &input;
257  _par = &parameter;
258  _result.reset(new ResultType());
259  }
260 
261 private:
262  ResultPtr _result;
263  ParameterType _defaultParameter;
264 };
266 } // namespace interface1
267 using interface1::BatchContainer;
268 using interface1::Batch;
269 } // namespace forward
270 } // namespace split
271 } // namespace layers
272 } // namespace neural_networks
273 } // namespace algorithms
274 } // namespace daal
275 #endif
daal::algorithms::neural_networks::layers::split::forward::interface1::Batch::getResult
ResultPtr getResult()
Definition: split_layer_forward.h:197
daal::algorithms::neural_networks::layers::split::forward::interface1::Batch::input
InputType input
Definition: split_layer_forward.h:127
daal::algorithms::neural_networks::layers::split::forward::interface1::Batch::Batch
DAAL_DEPRECATED Batch(ParameterType &parameter)
Definition: split_layer_forward.h:144
daal::algorithms::neural_networks::layers::split::forward::interface1::Batch::setResult
DAAL_DEPRECATED services::Status setResult(const ResultPtr &result)
Definition: split_layer_forward.h:209
daal::algorithms::neural_networks::layers::split::forward::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: split_layer_forward.h:155
daal::services::ErrorNullResult
Definition: error_indexes.h:98
daal::algorithms::neural_networks::layers::split::forward::interface1::BatchContainer
Provides methods to run implementations of the of the forward split layer This class is associated wi...
Definition: split_layer_forward.h:73
daal::algorithms::neural_networks::layers::split::forward::interface1::Batch
Computes the results of the forward split layer in the batch processing mode.
Definition: split_layer_forward.h:117
daal_defines.h
daal::algorithms::neural_networks::layers::split::forward::interface1::Batch::getLayerInput
virtual DAAL_DEPRECATED_VIRTUAL InputType * getLayerInput() DAAL_C11_OVERRIDE
Definition: split_layer_forward.h:173
daal::algorithms::dbscan::split
Definition: dbscan_types.h:167
daal::algorithms::neural_networks::layers::split::forward::interface1::Batch::getMethod
virtual DAAL_DEPRECATED_VIRTUAL int getMethod() const DAAL_C11_OVERRIDE
Definition: split_layer_forward.h:166
daal::algorithms::neural_networks::layers::split::forward::interface1::Batch::getLayerParameter
virtual DAAL_DEPRECATED_VIRTUAL ParameterType * getLayerParameter() DAAL_C11_OVERRIDE
Definition: split_layer_forward.h:180
daal::algorithms::neural_networks::layers::split::forward::interface1::BatchContainer::~BatchContainer
DAAL_DEPRECATED ~BatchContainer()
daal::algorithms::neural_networks::layers::split::forward::interface1::Batch::allocateResult
virtual DAAL_DEPRECATED_VIRTUAL services::Status allocateResult() DAAL_C11_OVERRIDE
Definition: split_layer_forward.h:234
daal::algorithms::neural_networks::layers::split::forward::interface1::BatchContainer::BatchContainer
DAAL_DEPRECATED BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::neural_networks::layers::split::forward::interface1::Batch::getLayerResult
DAAL_DEPRECATED layers::forward::ResultPtr getLayerResult() DAAL_C11_OVERRIDE
Definition: split_layer_forward.h:187
daal::algorithms::neural_networks::layers::split::forward::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::split::forward::interface1::Batch::parameter
ParameterType & parameter
Definition: split_layer_forward.h:126
daal::algorithms::neural_networks::layers::split::forward::interface1::Batch::clone
DAAL_DEPRECATED services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: split_layer_forward.h:223
daal::algorithms::neural_networks::layers::split::forward::interface1::Batch::Batch
DAAL_DEPRECATED Batch()
Default constructor.
Definition: split_layer_forward.h:133

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