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

layer_types.h
1 /* file: layer_types.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 neural_networks Network layer.
21 //--
22 */
23 
24 #ifndef __LAYERS_TYPES_H__
25 #define __LAYERS_TYPES_H__
26 
27 #include "algorithms/algorithm.h"
28 #include "data_management/data/tensor.h"
29 #include "services/daal_defines.h"
30 #include "services/collection.h"
31 #include "data_management/data/data_collection.h"
32 #include "algorithms/neural_networks/initializers/initializer.h"
33 #include "algorithms/neural_networks/initializers/uniform/uniform_initializer.h"
34 
35 namespace daal
36 {
37 namespace algorithms
38 {
42 namespace neural_networks
43 {
53 namespace layers
54 {
59 enum LayerInputLayout
60 {
61  tensorInput,
62  collectionInput,
63  lastLayerInputLayout = collectionInput
64 };
65 
70 enum LayerResultLayout
71 {
72  tensorResult,
73  collectionResult,
74  lastLayerResultLayout = collectionResult
75 };
79 namespace interface1
80 {
81 
87 class DAAL_EXPORT Parameter: public daal::algorithms::Parameter
88 {
89 public:
94  DAAL_DEPRECATED Parameter();
95 
97  initializers::InitializerIfacePtr weightsInitializer;
99  initializers::InitializerIfacePtr biasesInitializer;
101  bool predictionStage;
103  bool propagateGradient;
105  bool weightsAndBiasesInitialized;
107  bool allowInplaceComputation;
108 };
109 
113 typedef data_management::KeyValueDataCollection LayerData;
114 typedef services::SharedPtr<LayerData> LayerDataPtr;
115 
120 class NextLayers
121 {
122 public:
127  NextLayers() : _indices(0)
128  {}
129 
136  NextLayers(const NextLayers &other) : _indices(other._indices)
137  {}
138 
144  DAAL_DEPRECATED NextLayers(const size_t index1) : _indices()
145  {
146  _indices.push_back(index1);
147  }
148 
155  DAAL_DEPRECATED NextLayers(const size_t index1, const size_t index2) : _indices()
156  {
157  _indices.push_back(index1);
158  _indices.push_back(index2);
159  }
160 
168  DAAL_DEPRECATED NextLayers(const size_t index1, const size_t index2, const size_t index3) : _indices()
169  {
170  _indices.push_back(index1);
171  _indices.push_back(index2);
172  _indices.push_back(index3);
173  }
174 
183  DAAL_DEPRECATED NextLayers(const size_t index1, const size_t index2, const size_t index3, const size_t index4) : _indices()
184  {
185  _indices.push_back(index1);
186  _indices.push_back(index2);
187  _indices.push_back(index3);
188  _indices.push_back(index4);
189  }
190 
200  DAAL_DEPRECATED NextLayers(const size_t index1, const size_t index2, const size_t index3, const size_t index4,
201  const size_t index5) : _indices()
202  {
203  _indices.push_back(index1);
204  _indices.push_back(index2);
205  _indices.push_back(index3);
206  _indices.push_back(index4);
207  _indices.push_back(index5);
208  }
209 
220  DAAL_DEPRECATED NextLayers(const size_t index1, const size_t index2, const size_t index3, const size_t index4, const size_t index5,
221  const size_t index6) : _indices()
222  {
223  _indices.push_back(index1);
224  _indices.push_back(index2);
225  _indices.push_back(index3);
226  _indices.push_back(index4);
227  _indices.push_back(index5);
228  _indices.push_back(index6);
229  }
230 
231  /*
232  * \DAAL_DEPRECATED
233  */
234  virtual ~NextLayers()
235  {}
236 
242  size_t size() const { return _indices.size(); }
243 
250  DAAL_DEPRECATED size_t & operator [] (size_t index)
251  {
252  return _indices[index];
253  }
254 
261  const size_t & operator [] (size_t index) const
262  {
263  return _indices[index];
264  }
265 
271  void push_back(size_t index) { _indices.push_back(index); }
272 
278  void add(size_t index) { _indices.push_back(index); }
279 
280 protected:
281  services::Collection<size_t> _indices;
282 };
283 
284 }
285 using interface1::LayerData;
286 using interface1::LayerDataPtr;
287 using interface1::NextLayers;
288 using interface1::Parameter;
289 
290 } // namespace layers
292 } // namespace neural_networks
293 } // namespace algorithm
294 } // namespace daal
295 #endif
daal::algorithms::neural_networks::layers::interface1::NextLayers::operator[]
DAAL_DEPRECATED size_t & operator[](size_t index)
Definition: layer_types.h:250
daal::algorithms::neural_networks::layers::interface1::Parameter::propagateGradient
bool propagateGradient
Definition: layer_types.h:103
daal::algorithms::neural_networks::layers::interface1::NextLayers
Contains list of layer indices of layers following the current layer.
Definition: layer_types.h:120
daal::algorithms::neural_networks::layers::interface1::Parameter::biasesInitializer
initializers::InitializerIfacePtr biasesInitializer
Definition: layer_types.h:99
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:127
daal::algorithms::neural_networks::layers::interface1::NextLayers::NextLayers
DAAL_DEPRECATED 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:168
daal::algorithms::neural_networks::layers::interface1::Parameter::weightsInitializer
initializers::InitializerIfacePtr weightsInitializer
Definition: layer_types.h:97
daal::algorithms::neural_networks::layers::LayerInputLayout
LayerInputLayout
Definition: layer_types.h:59
daal::algorithms::neural_networks::layers::interface1::NextLayers::size
size_t size() const
Definition: layer_types.h:242
daal::algorithms::neural_networks::layers::interface1::NextLayers::NextLayers
DAAL_DEPRECATED 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:155
daal::algorithms::neural_networks::layers::interface1::NextLayers::push_back
void push_back(size_t index)
Definition: layer_types.h:271
daal_defines.h
daal::algorithms::neural_networks::layers::interface1::NextLayers::add
void add(size_t index)
Definition: layer_types.h:278
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:136
daal::algorithms::neural_networks::layers::interface1::NextLayers::NextLayers
DAAL_DEPRECATED 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:200
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:113
daal::algorithms::interface1::Parameter
Base class to represent computation parameters. Algorithm-specific parameters are represented as deri...
Definition: algorithm_types.h:62
daal::algorithms::neural_networks::layers::interface1::NextLayers::NextLayers
DAAL_DEPRECATED NextLayers(const size_t index1)
Constructs the list of layer indices from one index of the next layer.
Definition: layer_types.h:144
daal::algorithms::neural_networks::layers::interface1::NextLayers::NextLayers
DAAL_DEPRECATED 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:220
daal::algorithms::neural_networks::layers::interface1::NextLayers::NextLayers
DAAL_DEPRECATED 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:183
daal::algorithms::neural_networks::layers::interface1::Parameter
Definition: layer_types.h:87
daal::algorithms::neural_networks::layers::interface1::Parameter::allowInplaceComputation
bool allowInplaceComputation
Definition: layer_types.h:107
daal::algorithms::neural_networks::layers::interface1::Parameter::predictionStage
bool predictionStage
Definition: layer_types.h:101
daal::algorithms::neural_networks::layers::LayerResultLayout
LayerResultLayout
Definition: layer_types.h:70
daal::algorithms::neural_networks::layers::interface1::Parameter::weightsAndBiasesInitialized
bool weightsAndBiasesInitialized
Definition: layer_types.h:105

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