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

eltwise_sum_layer_forward_types.h
1 /* file: eltwise_sum_layer_forward_types.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 forward element-wise sum layer.
45 //--
46 */
47 
48 #ifndef __ELTWISE_SUM_LAYER_FORWARD_TYPES_H__
49 #define __ELTWISE_SUM_LAYER_FORWARD_TYPES_H__
50 
51 #include "algorithms/algorithm.h"
52 #include "services/daal_defines.h"
53 
54 #include "data_management/data/tensor.h"
55 
56 #include "algorithms/neural_networks/layers/layer_forward_types.h"
57 #include "algorithms/neural_networks/layers/eltwise_sum/eltwise_sum_layer_types.h"
58 
59 namespace daal
60 {
61 namespace algorithms
62 {
63 namespace neural_networks
64 {
65 namespace layers
66 {
67 namespace eltwise_sum
68 {
78 namespace forward
79 {
80 
85 enum InputId
86 {
87  coefficients = layers::forward::lastInputLayerDataId + 1,
88  lastInputId = coefficients
89 };
90 
94 namespace interface1
95 {
96 
101 class DAAL_EXPORT Input : public layers::forward::Input
102 {
103 public:
104  typedef layers::forward::Input super;
108  Input();
109 
111  Input(const Input& other);
112 
113  virtual ~Input() {}
114 
118  using layers::forward::Input::set;
122  using layers::forward::Input::get;
123 
129  data_management::TensorPtr get(InputId id) const;
130 
136  void set(InputId id, const data_management::TensorPtr &value);
137 
144  data_management::TensorPtr get(layers::forward::InputLayerDataId id, size_t index) const;
145 
152  void set(layers::forward::InputLayerDataId id, const data_management::TensorPtr &value, size_t index);
153 
161  virtual services::Status addData(const data_management::TensorPtr &dataTensor, size_t index) DAAL_C11_OVERRIDE;
162 
168  virtual services::Status eraseInputData() DAAL_C11_OVERRIDE;
169 
177  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
178 
179 private:
182  services::Status checkInputTensors(const LayerData &layerData) const;
183  services::Status checkCoefficients(const LayerData &layerData) const;
184 
185  LayerDataPtr getInputLayerDataAllocateIfEmpty();
186 };
187 
193 class DAAL_EXPORT Result : public layers::forward::Result
194 {
195 public:
196  DECLARE_SERIALIZABLE_CAST(Result);
197 
201  Result();
202 
203  virtual ~Result() {}
204 
208  using layers::forward::Result::get;
209 
213  using layers::forward::Result::set;
214 
223  template <typename algorithmFPType>
224  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input,
225  const daal::algorithms::Parameter *parameter, const int method);
226 
231  virtual const services::Collection<size_t> getValueSize(const services::Collection<size_t> &inputSize,
232  const daal::algorithms::Parameter *par, const int method) const DAAL_C11_OVERRIDE;
233 
241  virtual services::Collection<size_t> getValueSize(const services::Collection< services::Collection<size_t> > &inputSize,
242  const daal::algorithms::Parameter *parameter, const int method) DAAL_C11_OVERRIDE;
243 
249  data_management::TensorPtr get(LayerDataId id) const;
250 
256  data_management::NumericTablePtr get(LayerDataNumericTableId id) const;
257 
263  void set(LayerDataId id, const data_management::TensorPtr &value);
264 
270  void set(LayerDataNumericTableId id, const data_management::NumericTablePtr &value);
271 
278  virtual services::Status setResultForBackward(const daal::algorithms::Input *input) DAAL_C11_OVERRIDE;
279 
288  virtual services::Status check(const daal::algorithms::Input *input,
289  const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
290 
291 protected:
293  template<typename Archive, bool onDeserialize>
294  services::Status serialImpl(Archive *arch)
295  {
296  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
297  }
298 
299 private:
302  services::Status checkValue(const Input *input) const;
303  services::Status checkAuxCoefficients(const Input *input) const;
304  services::Status checkAuxNumberOfCoefficients(const Input *input) const;
305 
306  LayerDataPtr getResultLayerDataAllocateIfEmpty();
307 
308  template<typename algorithmFPType>
309  services::Status allocateValueTensor(const Input *eltwiseInput);
310 };
311 
312 typedef services::SharedPtr<Result> ResultPtr;
313 } // namespace interface1
314 
315 using interface1::Input;
316 using interface1::Result;
317 using interface1::ResultPtr;
318 
319 } // namespace forward
321 } // namespace eltwise_sum
322 } // namespace layers
323 } // namespace neural_networks
324 } // namespace algorithms
325 } // namespace daal
326 
327 #endif
daal::algorithms::neural_networks::layers::eltwise_sum::forward::coefficients
Definition: eltwise_sum_layer_forward_types.h:87
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::layers::forward::InputLayerDataId
InputLayerDataId
Definition: layer_forward_types.h:99
daal::algorithms::neural_networks::layers::eltwise_sum::forward::interface1::Result
Results obtained with the compute() method of the forward element-wise sum layer in the batch process...
Definition: eltwise_sum_layer_forward_types.h:193
daal::algorithms::neural_networks::layers::eltwise_sum::forward::interface1::Input
Input objects for the forward element-wise sum layer
Definition: eltwise_sum_layer_forward_types.h:101
daal::algorithms::neural_networks::layers::eltwise_sum::LayerDataNumericTableId
LayerDataNumericTableId
Available identifiers of input numeric tables for the backward element-wise sum layer and identifiers...
Definition: eltwise_sum_layer_types.h:98
daal::algorithms::neural_networks::layers::forward::interface1::Result::get
data_management::TensorPtr get(ResultId id) const
daal::algorithms::neural_networks::layers::eltwise_sum::forward::InputId
InputId
Definition: eltwise_sum_layer_forward_types.h:85
daal_defines.h
daal::algorithms::neural_networks::layers::eltwise_sum::LayerDataId
LayerDataId
Available identifiers of input tensors for the backward element-wise sum layer and identifiers of res...
Definition: eltwise_sum_layer_types.h:87
daal::algorithms::neural_networks::layers::forward::interface1::Result::set
void set(ResultId id, const data_management::TensorPtr &ptr)
daal::algorithms::interface1::Parameter
Base class to represent computation parameters. Algorithm-specific parameters are represented as deri...
Definition: algorithm_types.h:86
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::layers::forward::interface1::Result
Provides methods to access the result obtained with the compute() method of the layer algorithm...
Definition: layer_forward_types.h:241
daal::algorithms::neural_networks::layers::forward::interface1::Input::set
void set(InputId id, const data_management::TensorPtr &ptr)
daal::algorithms::neural_networks::layers::forward::interface1::Input::get
data_management::TensorPtr get(forward::InputId id) const
daal::algorithms::math::abs::value
Definition: abs_types.h:112
daal::algorithms::neural_networks::layers::forward::interface1::Input
Input objects for layer algorithm
Definition: layer_forward_types.h:149
daal::algorithms::interface1::Input
Base class to represent computation input arguments. Algorithm-specific input arguments are represent...
Definition: algorithm_types.h:217
daal::services::interface1::Collection
Class that implements functionality of the Collection container.
Definition: collection.h:69

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