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

neural_networks_training_input.h
1 /* file: neural_networks_training_input.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 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 network algorithm interface.
45 //--
46 */
47 
48 #ifndef __NEURAL_NETWORKS_TRAINING_INPUT_H__
49 #define __NEURAL_NETWORKS_TRAINING_INPUT_H__
50 
51 #include "algorithms/algorithm.h"
52 
53 #include "data_management/data/tensor.h"
54 #include "data_management/data/data_serialize.h"
55 #include "data_management/data/data_collection.h"
56 #include "services/daal_defines.h"
57 #include "algorithms/neural_networks/neural_networks_training_model.h"
58 #include "algorithms/neural_networks/neural_networks_training_partial_result.h"
59 
60 namespace daal
61 {
62 namespace algorithms
63 {
67 namespace neural_networks
68 {
69 namespace training
70 {
79 enum InputId
80 {
81  data,
82  groundTruth,
83  lastInputId = groundTruth
84 };
85 
90 enum InputCollectionId
91 {
92  groundTruthCollection = lastInputId + 1,
93  lastInputCollectionId = groundTruthCollection
94 };
95 
100 enum Step1LocalInputId
101 {
102  inputModel = lastInputCollectionId + 1,
103  lastStep1LocalInputId = inputModel
104 };
105 
110 enum Step2MasterInputId
111 {
112  partialResults,
114  lastStep2MasterInputId = partialResults
115 };
116 
120 namespace interface1
121 {
126 class DAAL_EXPORT Input : public daal::algorithms::Input
127 {
128 public:
129  Input(size_t nElements = lastInputCollectionId + 1);
130  Input(const Input& other);
131 
132  virtual ~Input() {}
133 
139  data_management::TensorPtr get(InputId id) const;
140 
146  data_management::KeyValueDataCollectionPtr get(InputCollectionId id) const;
147 
154  data_management::TensorPtr get(InputCollectionId id, size_t key) const;
155 
161  void set(InputId id, const data_management::TensorPtr &value);
162 
168  void set(InputCollectionId id, const data_management::KeyValueDataCollectionPtr &value);
169 
176  void add(InputCollectionId id, size_t key, const data_management::TensorPtr &value);
177 
185  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
186 
187 protected:
188  services::Status checkImpl(const daal::algorithms::Parameter *par, int method) const;
189 };
190 
195 template<ComputeStep step>
196 class DAAL_EXPORT DistributedInput
197 {};
198 
203 template<>
204 class DAAL_EXPORT DistributedInput<step1Local> : public Input
205 {
206 public:
207  DistributedInput(size_t nElements = lastStep1LocalInputId + 1);
208  DistributedInput(const DistributedInput& other);
209 
210  virtual ~DistributedInput() {};
211 
212  using Input::set;
213  using Input::get;
214 
220  ModelPtr get(Step1LocalInputId id) const;
221 
227  void set(Step1LocalInputId id, const ModelPtr &value);
228 
236  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
237 };
238 
243 template<>
244 class DAAL_EXPORT DistributedInput<step2Master> : public daal::algorithms::Input
245 {
246 public:
247  DistributedInput();
248  DistributedInput(const DistributedInput& other);
249 
250  virtual ~DistributedInput() {};
251 
257  data_management::KeyValueDataCollectionPtr get(Step2MasterInputId id) const;
258 
264  void set(Step2MasterInputId id, const data_management::KeyValueDataCollectionPtr &value);
265 
272  void add(Step2MasterInputId id, size_t key, const PartialResultPtr &value);
273 
281  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
282 };
283 
284 } // namespace interface1
285 using interface1::Input;
286 using interface1::DistributedInput;
287 
289 }
290 }
291 }
292 } // namespace daal
293 #endif
daal::services::interface1::Status
Class that holds the results of API calls. In case of API routine failure it contains the list of err...
Definition: error_handling.h:491
daal
Definition: algorithm_base_common.h:57
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:90
daal::algorithms::neural_networks::training::inputModel
Definition: neural_networks_training_input.h:102
daal::algorithms::neural_networks::training::data
Definition: neural_networks_training_input.h:81
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:79
daal::algorithms::neural_networks::training::interface1::Input
Input objects of the neural network training algorithm.
Definition: neural_networks_training_input.h:126
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:196
daal_defines.h
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::training::interface1::Input::get
data_management::TensorPtr get(InputId id) const
daal::algorithms::neural_networks::training::groundTruthCollection
Definition: neural_networks_training_input.h:92
daal::services::interface1::SharedPtr
Shared pointer that retains shared ownership of an object through a pointer. Several SharedPtr object...
Definition: daal_shared_ptr.h:187
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:112
daal::step1Local
Definition: daal_defines.h:143
daal::step2Master
Definition: daal_defines.h:144
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:100
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:110
daal::algorithms::interface1::Input
Base class to represent computation input arguments. Algorithm-specific input arguments are represent...
Definition: algorithm_types.h:217
daal::algorithms::neural_networks::training::partialResults
Definition: neural_networks_training_input.h:112
daal::algorithms::neural_networks::training::groundTruth
Definition: neural_networks_training_input.h:82

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