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

split_layer_backward.h
1 /* file: split_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 split layer in the batch
21 // processing mode
22 //--
23 */
24 
25 #ifndef __SPLIT_LAYER_BACKWARD_H__
26 #define __SPLIT_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/split/split_layer_types.h"
33 #include "algorithms/neural_networks/layers/split/split_layer_backward_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 backward
52 {
53 namespace interface1
54 {
72 template<typename algorithmFPType, Method method, CpuType cpu>
73 class BatchContainer : public AnalysisContainerIface<batch>
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 
114 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
115 class Batch : public layers::backward::LayerIfaceImpl
116 {
117 public:
118  typedef algorithms::neural_networks::layers::split::backward::Input InputType;
119  typedef algorithms::neural_networks::layers::split::Parameter ParameterType;
120  typedef algorithms::neural_networks::layers::split::backward::Result ResultType;
121 
122  ParameterType &parameter;
123  InputType input;
129  DAAL_DEPRECATED Batch() : parameter(_defaultParameter)
130  {
131  initialize();
132  };
133 
140  DAAL_DEPRECATED Batch(ParameterType& parameter) : parameter(parameter), _defaultParameter(parameter)
141  {
142  initialize();
143  }
144 
151  Batch(const Batch<algorithmFPType, method> &other) : _defaultParameter(other.parameter), parameter(_defaultParameter)
152  {
153  initialize();
154  input.set(layers::backward::inputFromForward, other.input.get(layers::backward::inputFromForward));
155  }
156 
162  DAAL_DEPRECATED_VIRTUAL virtual int getMethod() const DAAL_C11_OVERRIDE { return(int) method; }
163 
169  DAAL_DEPRECATED_VIRTUAL virtual InputType *getLayerInput() DAAL_C11_OVERRIDE { return &input; }
170 
176  DAAL_DEPRECATED_VIRTUAL virtual ParameterType *getLayerParameter() DAAL_C11_OVERRIDE { return &parameter; };
177 
183  DAAL_DEPRECATED layers::backward::ResultPtr getLayerResult() DAAL_C11_OVERRIDE
184  {
185  return _result;
186  }
187 
193  DAAL_DEPRECATED ResultPtr getResult()
194  {
195  return _result;
196  }
197 
205  DAAL_DEPRECATED services::Status setResult(const ResultPtr& result)
206  {
207  DAAL_CHECK(result, services::ErrorNullResult)
208  _result = result;
209  _res = _result.get();
210  return services::Status();
211  }
212 
219  DAAL_DEPRECATED services::SharedPtr<Batch<algorithmFPType, method> > clone() const
220  {
221  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
222  }
223 
230  DAAL_DEPRECATED_VIRTUAL virtual services::Status allocateResult() DAAL_C11_OVERRIDE
231  {
232  services::Status s = this->_result->template allocate<algorithmFPType>(&(this->input),&parameter, (int) method);
233  this->_res = this->_result.get();
234  return s;
235  }
236 
237 protected:
238  /*
239  * \DAAL_DEPRECATED
240  */
241  DAAL_DEPRECATED_VIRTUAL virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
242  {
243  return new Batch<algorithmFPType, method>(*this);
244  }
245 
246  /*
247  * \DAAL_DEPRECATED
248  */
249  void initialize()
250  {
251  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
252  _in = &input;
253  _par = &parameter;
254  _result.reset(new ResultType());
255  }
256 
257 private:
258  ResultPtr _result;
259  ParameterType _defaultParameter;
260 };
262 } // namespace interface1
263 using interface1::BatchContainer;
264 using interface1::Batch;
265 } // namespace backward
266 } // namespace split
267 } // namespace layers
268 } // namespace neural_networks
269 } // namespace algorithms
270 } // namespace daal
271 #endif
daal::algorithms::neural_networks::layers::split::backward::interface1::Batch::setResult
DAAL_DEPRECATED services::Status setResult(const ResultPtr &result)
Definition: split_layer_backward.h:205
daal::algorithms::neural_networks::layers::split::backward::interface1::Batch::getLayerResult
DAAL_DEPRECATED layers::backward::ResultPtr getLayerResult() DAAL_C11_OVERRIDE
Definition: split_layer_backward.h:183
daal::batch
Definition: daal_defines.h:112
daal::algorithms::neural_networks::layers::split::backward::interface1::BatchContainer
Provides methods to run implementations of the of the backward split layer This class is associated w...
Definition: split_layer_backward.h:73
daal::algorithms::neural_networks::layers::split::backward::interface1::Batch::Batch
DAAL_DEPRECATED Batch()
Definition: split_layer_backward.h:129
daal::algorithms::neural_networks::layers::split::backward::interface1::Batch::getLayerInput
virtual DAAL_DEPRECATED_VIRTUAL InputType * getLayerInput() DAAL_C11_OVERRIDE
Definition: split_layer_backward.h:169
daal::algorithms::neural_networks::layers::split::backward::interface1::Batch::input
InputType input
Definition: split_layer_backward.h:123
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::split::backward::interface1::Batch::clone
DAAL_DEPRECATED services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: split_layer_backward.h:219
daal_defines.h
daal::algorithms::dbscan::split
Definition: dbscan_types.h:167
daal::algorithms::neural_networks::layers::split::backward::interface1::Batch::parameter
ParameterType & parameter
Definition: split_layer_backward.h:122
daal::algorithms::neural_networks::layers::split::backward::interface1::Batch::Batch
DAAL_DEPRECATED Batch(ParameterType &parameter)
Definition: split_layer_backward.h:140
daal::algorithms::neural_networks::layers::backward::inputFromForward
Definition: layer_backward_types.h:76
daal::algorithms::neural_networks::layers::split::backward::interface1::BatchContainer::BatchContainer
DAAL_DEPRECATED BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::neural_networks::layers::split::backward::interface1::BatchContainer::~BatchContainer
DAAL_DEPRECATED ~BatchContainer()
daal::algorithms::neural_networks::layers::split::backward::interface1::Batch::getMethod
virtual DAAL_DEPRECATED_VIRTUAL int getMethod() const DAAL_C11_OVERRIDE
Definition: split_layer_backward.h:162
daal::algorithms::neural_networks::layers::split::backward::interface1::Batch::getResult
DAAL_DEPRECATED ResultPtr getResult()
Definition: split_layer_backward.h:193
daal::algorithms::neural_networks::layers::split::backward::interface1::Batch::allocateResult
virtual DAAL_DEPRECATED_VIRTUAL services::Status allocateResult() DAAL_C11_OVERRIDE
Definition: split_layer_backward.h:230
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::backward::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: split_layer_backward.h:151
daal::algorithms::neural_networks::layers::split::backward::interface1::Batch
Computes the results of the backward split layer in the batch processing mode.
Definition: split_layer_backward.h:115
daal::algorithms::neural_networks::layers::split::backward::interface1::BatchContainer::compute
DAAL_DEPRECATED services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::neural_networks::layers::split::backward::interface1::Batch::getLayerParameter
virtual DAAL_DEPRECATED_VIRTUAL ParameterType * getLayerParameter() DAAL_C11_OVERRIDE
Definition: split_layer_backward.h:176

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