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

layer_types.h
1 /* file: layer_types.h */
2 /*******************************************************************************
3 * Copyright 2014-2017 Intel Corporation
4 * All Rights Reserved.
5 *
6 * If this software was obtained under the Intel Simplified Software License,
7 * the following terms apply:
8 *
9 * The source code, information and material ("Material") contained herein is
10 * owned by Intel Corporation or its suppliers or licensors, and title to such
11 * Material remains with Intel Corporation or its suppliers or licensors. The
12 * Material contains proprietary information of Intel or its suppliers and
13 * licensors. The Material is protected by worldwide copyright laws and treaty
14 * provisions. No part of the Material may be used, copied, reproduced,
15 * modified, published, uploaded, posted, transmitted, distributed or disclosed
16 * in any way without Intel's prior express written permission. No license under
17 * any patent, copyright or other intellectual property rights in the Material
18 * is granted to or conferred upon you, either expressly, by implication,
19 * inducement, estoppel or otherwise. Any license under such intellectual
20 * property rights must be express and approved by Intel in writing.
21 *
22 * Unless otherwise agreed by Intel in writing, you may not remove or alter this
23 * notice or any other notice embedded in Materials by Intel or Intel's
24 * suppliers or licensors in any way.
25 *
26 *
27 * If this software was obtained under the Apache License, Version 2.0 (the
28 * "License"), the following terms apply:
29 *
30 * You may not use this file except in compliance with the License. You may
31 * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
32 *
33 *
34 * Unless required by applicable law or agreed to in writing, software
35 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
36 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37 *
38 * See the License for the specific language governing permissions and
39 * limitations under the License.
40 *******************************************************************************/
41 
42 /*
43 //++
44 // Implementation of neural_networks Network layer.
45 //--
46 */
47 
48 #ifndef __LAYERS_TYPES_H__
49 #define __LAYERS_TYPES_H__
50 
51 #include "algorithms/algorithm.h"
52 #include "data_management/data/tensor.h"
53 #include "services/daal_defines.h"
54 #include "services/collection.h"
55 #include "data_management/data/data_collection.h"
56 #include "algorithms/neural_networks/initializers/initializer.h"
57 #include "algorithms/neural_networks/initializers/uniform/uniform_initializer.h"
58 
59 namespace daal
60 {
61 namespace algorithms
62 {
66 namespace neural_networks
67 {
77 namespace layers
78 {
83 enum LayerInputLayout
84 {
85  tensorInput,
86  collectionInput,
87  lastLayerInputLayout = collectionInput
88 };
89 
94 enum LayerResultLayout
95 {
96  tensorResult,
97  collectionResult,
98  lastLayerResultLayout = collectionResult
99 };
103 namespace interface1
104 {
105 
110 class DAAL_EXPORT Parameter: public daal::algorithms::Parameter
111 {
112 public:
114  Parameter();
115 
117  initializers::InitializerIfacePtr weightsInitializer;
119  initializers::InitializerIfacePtr biasesInitializer;
121  bool predictionStage;
123  bool propagateGradient;
125  bool weightsAndBiasesInitialized;
127  bool allowInplaceComputation;
128 };
129 
133 typedef data_management::KeyValueDataCollection LayerData;
134 typedef services::SharedPtr<LayerData> LayerDataPtr;
135 
140 class NextLayers
141 {
142 public:
146  NextLayers() : _indices(0)
147  {}
148 
154  NextLayers(const NextLayers &other) : _indices(other._indices)
155  {}
156 
161  NextLayers(const size_t index1) : _indices()
162  {
163  _indices.push_back(index1);
164  }
165 
171  NextLayers(const size_t index1, const size_t index2) : _indices()
172  {
173  _indices.push_back(index1);
174  _indices.push_back(index2);
175  }
176 
183  NextLayers(const size_t index1, const size_t index2, const size_t index3) : _indices()
184  {
185  _indices.push_back(index1);
186  _indices.push_back(index2);
187  _indices.push_back(index3);
188  }
189 
197  NextLayers(const size_t index1, const size_t index2, const size_t index3, const size_t index4) : _indices()
198  {
199  _indices.push_back(index1);
200  _indices.push_back(index2);
201  _indices.push_back(index3);
202  _indices.push_back(index4);
203  }
204 
213  NextLayers(const size_t index1, const size_t index2, const size_t index3, const size_t index4,
214  const size_t index5) : _indices()
215  {
216  _indices.push_back(index1);
217  _indices.push_back(index2);
218  _indices.push_back(index3);
219  _indices.push_back(index4);
220  _indices.push_back(index5);
221  }
222 
232  NextLayers(const size_t index1, const size_t index2, const size_t index3, const size_t index4, const size_t index5,
233  const size_t index6) : _indices()
234  {
235  _indices.push_back(index1);
236  _indices.push_back(index2);
237  _indices.push_back(index3);
238  _indices.push_back(index4);
239  _indices.push_back(index5);
240  _indices.push_back(index6);
241  }
242 
243  virtual ~NextLayers()
244  {}
245 
250  size_t size() const { return _indices.size(); }
251 
257  size_t & operator [] (size_t index)
258  {
259  return _indices[index];
260  }
261 
267  const size_t & operator [] (size_t index) const
268  {
269  return _indices[index];
270  }
271 
276  void push_back(size_t index) { _indices.push_back(index); }
277 
282  void add(size_t index) { _indices.push_back(index); }
283 
284 protected:
285  services::Collection<size_t> _indices;
286 };
287 
288 }
289 using interface1::LayerData;
290 using interface1::LayerDataPtr;
291 using interface1::NextLayers;
292 using interface1::Parameter;
293 
294 } // namespace layers
296 } // namespace neural_networks
297 } // namespace algorithm
298 } // namespace daal
299 #endif
daal
Definition: algorithm_base_common.h:57
daal::algorithms::neural_networks::layers::interface1::Parameter::weightsAndBiasesInitialized
bool weightsAndBiasesInitialized
Definition: layer_types.h:125
daal::algorithms::neural_networks::layers::interface1::NextLayers::size
size_t size() const
Definition: layer_types.h:250
daal::algorithms::neural_networks::layers::interface1::Parameter
Definition: layer_types.h:110
daal::algorithms::neural_networks::layers::interface1::NextLayers
Contains list of layer indices of layers following the current layer.
Definition: layer_types.h:140
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:154
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:171
daal::algorithms::interface1::Parameter
Base class to represent computation parameters. Algorithm-specific parameters are represented as deri...
Definition: algorithm_types.h:86
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:183
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:232
daal::algorithms::neural_networks::layers::interface1::Parameter::weightsInitializer
initializers::InitializerIfacePtr weightsInitializer
Definition: layer_types.h:117
daal::algorithms::neural_networks::layers::LayerInputLayout
LayerInputLayout
Definition: layer_types.h:83
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:213
daal::algorithms::neural_networks::layers::interface1::NextLayers::push_back
void push_back(size_t index)
Definition: layer_types.h:276
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:146
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:133
daal::algorithms::neural_networks::layers::LayerResultLayout
LayerResultLayout
Definition: layer_types.h:94
daal::algorithms::neural_networks::layers::interface1::Parameter::predictionStage
bool predictionStage
Definition: layer_types.h:121
daal::algorithms::neural_networks::layers::interface1::Parameter::biasesInitializer
initializers::InitializerIfacePtr biasesInitializer
Definition: layer_types.h:119
daal::algorithms::neural_networks::layers::interface1::Parameter::allowInplaceComputation
bool allowInplaceComputation
Definition: layer_types.h:127
daal::algorithms::neural_networks::layers::interface1::Parameter::propagateGradient
bool propagateGradient
Definition: layer_types.h:123
daal::algorithms::neural_networks::layers::interface1::NextLayers::add
void add(size_t index)
Definition: layer_types.h:282
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:197
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:161
daal::algorithms::neural_networks::layers::interface1::NextLayers::operator[]
size_t & operator[](size_t index)
Definition: layer_types.h:257

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