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

initializer_types.h
1 /* file: initializer_types.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 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 neural_networks Network layer.
19 //--
20 */
21 
22 #ifndef __INITIALIZERS__TYPES__H__
23 #define __INITIALIZERS__TYPES__H__
24 
25 #include "algorithms/algorithm.h"
26 #include "data_management/data/tensor.h"
27 #include "services/daal_defines.h"
28 #include "services/collection.h"
29 #include "data_management/data/data_collection.h"
30 #include "algorithms/neural_networks/initializers/initializer_types_defs.h"
31 #include "algorithms/engines/engine.h"
32 #include "algorithms/engines/mt19937/mt19937.h"
33 
34 namespace daal
35 {
36 namespace algorithms
37 {
38 namespace neural_networks
39 {
49 namespace initializers
50 {
55 enum InputId
56 {
57  data,
58  lastInputId = data
59 };
60 
65 enum ResultId
66 {
67  value,
68  lastResultId = value
69 };
70 
74 namespace interface1
75 {
76 
81 class Parameter: public daal::algorithms::Parameter
82 {
83 public:
84  Parameter(layers::forward::LayerIfacePtr layerForParameter = layers::forward::LayerIfacePtr()): layer(layerForParameter) {}
85  virtual ~Parameter() {}
86 
87  layers::forward::LayerIfacePtr layer;
88  engines::EnginePtr engine;
89 };
90 
95 class DAAL_EXPORT Input : public daal::algorithms::Input
96 {
97 public:
101  Input() : daal::algorithms::Input(1) {}
103  Input(const Input& other) : daal::algorithms::Input(other){}
104 
105  virtual ~Input() {}
106 
112  data_management::TensorPtr get(InputId id) const
113  {
114  return data_management::Tensor::cast(Argument::get(id));
115  }
116 
122  void set(InputId id, const data_management::TensorPtr &ptr)
123  {
124  Argument::set(id, ptr);
125  }
126 
134  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
135 };
136 
141 class DAAL_EXPORT Result : public daal::algorithms::Result
142 {
143 public:
145  Result() : daal::algorithms::Result(1) {}
146 
147  virtual ~Result() {}
148 
157  template <typename algorithmFPType>
158  services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method)
159  {
160  const Input *algInput = static_cast<const Input *>(input);
161 
162  set(value, algInput->get(data));
163  return services::Status();
164  }
165 
171  data_management::TensorPtr get(ResultId id) const
172  {
173  return data_management::Tensor::cast(Argument::get(id));
174  }
175 
181  void set(ResultId id, const data_management::TensorPtr &ptr)
182  {
183  Argument::set(id, ptr);
184  }
185 
194  virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter,
195  int method) const DAAL_C11_OVERRIDE;
196 
197 protected:
199  template<typename Archive, bool onDeserialize>
200  services::Status serialImpl(Archive *arch)
201  {
202  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
203  }
204 };
205 typedef services::SharedPtr<Result> ResultPtr;
206 } // interface1
207 using interface1::Input;
208 using interface1::Result;
209 using interface1::ResultPtr;
210 using interface1::Parameter;
211 } // namespace initializers
213 } // namespace neural_networks
214 } // namespace algorithm
215 } // namespace daal
216 #endif
daal::algorithms::neural_networks::initializers::interface1::Parameter::layer
layers::forward::LayerIfacePtr layer
Definition: initializer_types.h:87
daal
Definition: algorithm_base_common.h:31
daal::algorithms::interface1::Result
Base class to represent final results of the computation. Algorithm-specific final results are repres...
Definition: algorithm_types.h:307
daal::algorithms::neural_networks::initializers::value
Definition: initializer_types.h:67
daal::algorithms::neural_networks::initializers::interface1::Input::Input
Input()
Definition: initializer_types.h:101
daal::algorithms::neural_networks::initializers::interface1::Input::Input
Input(const Input &other)
Definition: initializer_types.h:103
daal::algorithms::neural_networks::initializers::interface1::Input
Input objects for initializer algorithm
Definition: initializer_types.h:95
daal::algorithms::neural_networks::initializers::interface1::Result::Result
Result()
Constructor.
Definition: initializer_types.h:145
daal::algorithms::neural_networks::initializers::ResultId
ResultId
Definition: initializer_types.h:65
daal_defines.h
daal::algorithms::neural_networks::initializers::interface1::Parameter::engine
engines::EnginePtr engine
Definition: initializer_types.h:88
daal::algorithms::neural_networks::initializers::interface1::Input::set
void set(InputId id, const data_management::TensorPtr &ptr)
Definition: initializer_types.h:122
daal::algorithms::interface1::Parameter
Base class to represent computation parameters. Algorithm-specific parameters are represented as deri...
Definition: algorithm_types.h:60
daal::algorithms::neural_networks::initializers::interface1::Result
Provides methods to access the result obtained with the compute() method of the neural network weight...
Definition: initializer_types.h:141
daal::algorithms::neural_networks::initializers::interface1::Result::allocate
services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method)
Definition: initializer_types.h:158
daal::algorithms::neural_networks::initializers::interface1::Input::get
data_management::TensorPtr get(InputId id) const
Definition: initializer_types.h:112
daal::algorithms::neural_networks::initializers::InputId
InputId
Definition: initializer_types.h:55
daal::algorithms::interface1::Input
Base class to represent computation input arguments. Algorithm-specific input arguments are represent...
Definition: algorithm_types.h:191
daal::algorithms::neural_networks::initializers::data
Definition: initializer_types.h:57
daal::algorithms::neural_networks::initializers::interface1::Result::set
void set(ResultId id, const data_management::TensorPtr &ptr)
Definition: initializer_types.h:181
daal::algorithms::neural_networks::initializers::interface1::Parameter
Definition: initializer_types.h:81

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