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

neural_networks_training_input.h
1 /* file: neural_networks_training_input.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 network algorithm interface.
19 //--
20 */
21 
22 #ifndef __NEURAL_NETWORKS_TRAINING_INPUT_H__
23 #define __NEURAL_NETWORKS_TRAINING_INPUT_H__
24 
25 #include "algorithms/algorithm.h"
26 
27 #include "data_management/data/tensor.h"
28 #include "data_management/data/data_serialize.h"
29 #include "data_management/data/data_collection.h"
30 #include "services/daal_defines.h"
31 #include "algorithms/neural_networks/neural_networks_training_model.h"
32 #include "algorithms/neural_networks/neural_networks_training_partial_result.h"
33 
34 namespace daal
35 {
36 namespace algorithms
37 {
41 namespace neural_networks
42 {
43 namespace training
44 {
53 enum InputId
54 {
55  data,
56  groundTruth,
57  lastInputId = groundTruth
58 };
59 
64 enum InputCollectionId
65 {
66  groundTruthCollection = lastInputId + 1,
67  lastInputCollectionId = groundTruthCollection
68 };
69 
74 enum Step1LocalInputId
75 {
76  inputModel = lastInputCollectionId + 1,
77  lastStep1LocalInputId = inputModel
78 };
79 
84 enum Step2MasterInputId
85 {
86  partialResults,
88  lastStep2MasterInputId = partialResults
89 };
90 
94 namespace interface1
95 {
100 class DAAL_EXPORT Input : public daal::algorithms::Input
101 {
102 public:
103  Input(size_t nElements = lastInputCollectionId + 1);
104  Input(const Input& other);
105 
106  virtual ~Input() {}
107 
113  data_management::TensorPtr get(InputId id) const;
114 
120  data_management::KeyValueDataCollectionPtr get(InputCollectionId id) const;
121 
128  data_management::TensorPtr get(InputCollectionId id, size_t key) const;
129 
135  void set(InputId id, const data_management::TensorPtr &value);
136 
142  void set(InputCollectionId id, const data_management::KeyValueDataCollectionPtr &value);
143 
150  void add(InputCollectionId id, size_t key, const data_management::TensorPtr &value);
151 
159  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
160 
161 protected:
162  services::Status checkImpl(const daal::algorithms::Parameter *par, int method) const;
163 };
164 
169 template<ComputeStep step>
170 class DAAL_EXPORT DistributedInput
171 {};
172 
177 template<>
178 class DAAL_EXPORT DistributedInput<step1Local> : public Input
179 {
180 public:
181  DistributedInput(size_t nElements = lastStep1LocalInputId + 1);
182  DistributedInput(const DistributedInput& other);
183 
184  virtual ~DistributedInput() {};
185 
186  using Input::set;
187  using Input::get;
188 
194  ModelPtr get(Step1LocalInputId id) const;
195 
201  void set(Step1LocalInputId id, const ModelPtr &value);
202 
210  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
211 };
212 
217 template<>
218 class DAAL_EXPORT DistributedInput<step2Master> : public daal::algorithms::Input
219 {
220 public:
221  DistributedInput();
222  DistributedInput(const DistributedInput& other);
223 
224  virtual ~DistributedInput() {};
225 
231  data_management::KeyValueDataCollectionPtr get(Step2MasterInputId id) const;
232 
238  void set(Step2MasterInputId id, const data_management::KeyValueDataCollectionPtr &value);
239 
246  void add(Step2MasterInputId id, size_t key, const PartialResultPtr &value);
247 
255  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
256 };
257 
258 } // namespace interface1
259 using interface1::Input;
260 using interface1::DistributedInput;
261 
263 }
264 }
265 }
266 } // namespace daal
267 #endif
daal
Definition: algorithm_base_common.h:31
daal::algorithms::neural_networks::training::InputCollectionId
InputCollectionId
Available identifiers of input collection objects for the neural network model based training...
Definition: neural_networks_training_input.h:64
daal::algorithms::neural_networks::training::inputModel
Definition: neural_networks_training_input.h:76
daal::algorithms::neural_networks::training::data
Definition: neural_networks_training_input.h:55
daal::algorithms::neural_networks::training::InputId
InputId
Available identifiers of input objects for the neural network model based training.
Definition: neural_networks_training_input.h:53
daal::algorithms::neural_networks::training::interface1::Input
Input objects of the neural network training algorithm.
Definition: neural_networks_training_input.h:100
daal::algorithms::neural_networks::training::interface1::DistributedInput
Input objects of the neural network training algorithm in the distributed processing mode...
Definition: neural_networks_training_input.h:170
daal_defines.h
daal::algorithms::neural_networks::training::groundTruthCollection
Definition: neural_networks_training_input.h:66
daal::algorithms::neural_networks::training::interface1::Input::get
data_management::TensorPtr get(InputId id) const
daal::algorithms::neural_networks::training::interface1::Input::set
void set(InputId id, const data_management::TensorPtr &value)
daal::algorithms::math::abs::value
Definition: abs_types.h:86
daal::step1Local
Definition: daal_defines.h:117
daal::step2Master
Definition: daal_defines.h:118
daal::algorithms::neural_networks::training::Step1LocalInputId
Step1LocalInputId
Available identifiers of input objects for the neural network model based training.
Definition: neural_networks_training_input.h:74
daal::algorithms::neural_networks::training::Step2MasterInputId
Step2MasterInputId
Partial results from the previous steps in the distributed processing mode required by the second dis...
Definition: neural_networks_training_input.h:84
daal::algorithms::neural_networks::training::partialResults
Definition: neural_networks_training_input.h:86
daal::algorithms::neural_networks::training::groundTruth
Definition: neural_networks_training_input.h:56

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