C++ API Reference for Intel® Data Analytics Acceleration Library 2018 Update 3

layer_types.h
1 /* file: layer_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 __LAYERS_TYPES_H__
23 #define __LAYERS_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.h"
31 #include "algorithms/neural_networks/initializers/uniform/uniform_initializer.h"
32 
33 namespace daal
34 {
35 namespace algorithms
36 {
40 namespace neural_networks
41 {
51 namespace layers
52 {
57 enum LayerInputLayout
58 {
59  tensorInput,
60  collectionInput,
61  lastLayerInputLayout = collectionInput
62 };
63 
68 enum LayerResultLayout
69 {
70  tensorResult,
71  collectionResult,
72  lastLayerResultLayout = collectionResult
73 };
77 namespace interface1
78 {
79 
84 class DAAL_EXPORT Parameter: public daal::algorithms::Parameter
85 {
86 public:
88  Parameter();
89 
91  initializers::InitializerIfacePtr weightsInitializer;
93  initializers::InitializerIfacePtr biasesInitializer;
95  bool predictionStage;
97  bool propagateGradient;
99  bool weightsAndBiasesInitialized;
101  bool allowInplaceComputation;
102 };
103 
107 typedef data_management::KeyValueDataCollection LayerData;
108 typedef services::SharedPtr<LayerData> LayerDataPtr;
109 
114 class NextLayers
115 {
116 public:
120  NextLayers() : _indices(0)
121  {}
122 
128  NextLayers(const NextLayers &other) : _indices(other._indices)
129  {}
130 
135  NextLayers(const size_t index1) : _indices()
136  {
137  _indices.push_back(index1);
138  }
139 
145  NextLayers(const size_t index1, const size_t index2) : _indices()
146  {
147  _indices.push_back(index1);
148  _indices.push_back(index2);
149  }
150 
157  NextLayers(const size_t index1, const size_t index2, const size_t index3) : _indices()
158  {
159  _indices.push_back(index1);
160  _indices.push_back(index2);
161  _indices.push_back(index3);
162  }
163 
171  NextLayers(const size_t index1, const size_t index2, const size_t index3, const size_t index4) : _indices()
172  {
173  _indices.push_back(index1);
174  _indices.push_back(index2);
175  _indices.push_back(index3);
176  _indices.push_back(index4);
177  }
178 
187  NextLayers(const size_t index1, const size_t index2, const size_t index3, const size_t index4,
188  const size_t index5) : _indices()
189  {
190  _indices.push_back(index1);
191  _indices.push_back(index2);
192  _indices.push_back(index3);
193  _indices.push_back(index4);
194  _indices.push_back(index5);
195  }
196 
206  NextLayers(const size_t index1, const size_t index2, const size_t index3, const size_t index4, const size_t index5,
207  const size_t index6) : _indices()
208  {
209  _indices.push_back(index1);
210  _indices.push_back(index2);
211  _indices.push_back(index3);
212  _indices.push_back(index4);
213  _indices.push_back(index5);
214  _indices.push_back(index6);
215  }
216 
217  virtual ~NextLayers()
218  {}
219 
224  size_t size() const { return _indices.size(); }
225 
231  size_t & operator [] (size_t index)
232  {
233  return _indices[index];
234  }
235 
241  const size_t & operator [] (size_t index) const
242  {
243  return _indices[index];
244  }
245 
250  void push_back(size_t index) { _indices.push_back(index); }
251 
256  void add(size_t index) { _indices.push_back(index); }
257 
258 protected:
259  services::Collection<size_t> _indices;
260 };
261 
262 }
263 using interface1::LayerData;
264 using interface1::LayerDataPtr;
265 using interface1::NextLayers;
266 using interface1::Parameter;
267 
268 } // namespace layers
270 } // namespace neural_networks
271 } // namespace algorithm
272 } // namespace daal
273 #endif
daal
Definition: algorithm_base_common.h:31
daal::algorithms::neural_networks::layers::interface1::Parameter::weightsAndBiasesInitialized
bool weightsAndBiasesInitialized
Definition: layer_types.h:99
daal::algorithms::neural_networks::layers::interface1::NextLayers::size
size_t size() const
Definition: layer_types.h:224
daal::algorithms::neural_networks::layers::interface1::Parameter
Definition: layer_types.h:84
daal::algorithms::neural_networks::layers::interface1::NextLayers
Contains list of layer indices of layers following the current layer.
Definition: layer_types.h:114
daal::algorithms::neural_networks::layers::interface1::NextLayers::NextLayers
NextLayers(const NextLayers &other)
Constructs the list of layer indices by copying the indices from another list of layer indices...
Definition: layer_types.h:128
daal_defines.h
daal::algorithms::neural_networks::layers::interface1::NextLayers::NextLayers
NextLayers(const size_t index1, const size_t index2)
Constructs the list of layer indices from two indices of the next layers.
Definition: layer_types.h:145
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::layers::interface1::NextLayers::NextLayers
NextLayers(const size_t index1, const size_t index2, const size_t index3)
Constructs the list of layer indices from three indices of the next layers.
Definition: layer_types.h:157
daal::algorithms::neural_networks::layers::interface1::NextLayers::NextLayers
NextLayers(const size_t index1, const size_t index2, const size_t index3, const size_t index4, const size_t index5, const size_t index6)
Constructs the list of layer indices from six indices of the next layers.
Definition: layer_types.h:206
daal::algorithms::neural_networks::layers::interface1::Parameter::weightsInitializer
initializers::InitializerIfacePtr weightsInitializer
Definition: layer_types.h:91
daal::algorithms::neural_networks::layers::LayerInputLayout
LayerInputLayout
Definition: layer_types.h:57
daal::algorithms::neural_networks::layers::interface1::NextLayers::NextLayers
NextLayers(const size_t index1, const size_t index2, const size_t index3, const size_t index4, const size_t index5)
Constructs the list of layer indices from five indices of the next layers.
Definition: layer_types.h:187
daal::algorithms::neural_networks::layers::interface1::NextLayers::push_back
void push_back(size_t index)
Definition: layer_types.h:250
daal::algorithms::neural_networks::layers::interface1::NextLayers::NextLayers
NextLayers()
Constructs empty list of layer indices of layers following the current layer.
Definition: layer_types.h:120
daal::algorithms::neural_networks::layers::interface1::LayerData
data_management::KeyValueDataCollection LayerData
Contains extra input and output object of neural network layer.
Definition: layer_types.h:107
daal::algorithms::neural_networks::layers::LayerResultLayout
LayerResultLayout
Definition: layer_types.h:68
daal::algorithms::neural_networks::layers::interface1::Parameter::predictionStage
bool predictionStage
Definition: layer_types.h:95
daal::algorithms::neural_networks::layers::interface1::Parameter::biasesInitializer
initializers::InitializerIfacePtr biasesInitializer
Definition: layer_types.h:93
daal::algorithms::neural_networks::layers::interface1::Parameter::allowInplaceComputation
bool allowInplaceComputation
Definition: layer_types.h:101
daal::algorithms::neural_networks::layers::interface1::Parameter::propagateGradient
bool propagateGradient
Definition: layer_types.h:97
daal::algorithms::neural_networks::layers::interface1::NextLayers::add
void add(size_t index)
Definition: layer_types.h:256
daal::algorithms::neural_networks::layers::interface1::NextLayers::NextLayers
NextLayers(const size_t index1, const size_t index2, const size_t index3, const size_t index4)
Constructs the list of layer indices from four indices of the next layers.
Definition: layer_types.h:171
daal::algorithms::neural_networks::layers::interface1::NextLayers::NextLayers
NextLayers(const size_t index1)
Constructs the list of layer indices from one index of the next layer.
Definition: layer_types.h:135
daal::algorithms::neural_networks::layers::interface1::NextLayers::operator[]
size_t & operator[](size_t index)
Definition: layer_types.h:231

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