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

eltwise_sum_layer_forward_types.h
1 /* file: eltwise_sum_layer_forward_types.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 forward element-wise sum layer.
19 //--
20 */
21 
22 #ifndef __ELTWISE_SUM_LAYER_FORWARD_TYPES_H__
23 #define __ELTWISE_SUM_LAYER_FORWARD_TYPES_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "services/daal_defines.h"
27 
28 #include "data_management/data/tensor.h"
29 
30 #include "algorithms/neural_networks/layers/layer_forward_types.h"
31 #include "algorithms/neural_networks/layers/eltwise_sum/eltwise_sum_layer_types.h"
32 
33 namespace daal
34 {
35 namespace algorithms
36 {
37 namespace neural_networks
38 {
39 namespace layers
40 {
41 namespace eltwise_sum
42 {
52 namespace forward
53 {
54 
59 enum InputId
60 {
61  coefficients = layers::forward::lastInputLayerDataId + 1,
62  lastInputId = coefficients
63 };
64 
68 namespace interface1
69 {
70 
75 class DAAL_EXPORT Input : public layers::forward::Input
76 {
77 public:
78  typedef layers::forward::Input super;
82  Input();
83 
85  Input(const Input& other);
86 
87  virtual ~Input() {}
88 
92  using layers::forward::Input::set;
96  using layers::forward::Input::get;
97 
103  data_management::TensorPtr get(InputId id) const;
104 
110  void set(InputId id, const data_management::TensorPtr &value);
111 
118  data_management::TensorPtr get(layers::forward::InputLayerDataId id, size_t index) const;
119 
126  void set(layers::forward::InputLayerDataId id, const data_management::TensorPtr &value, size_t index);
127 
135  virtual services::Status addData(const data_management::TensorPtr &dataTensor, size_t index) DAAL_C11_OVERRIDE;
136 
142  virtual services::Status eraseInputData() DAAL_C11_OVERRIDE;
143 
151  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
152 
153 private:
156  services::Status checkInputTensors(const LayerData &layerData) const;
157  services::Status checkCoefficients(const LayerData &layerData) const;
158 
159  LayerDataPtr getInputLayerDataAllocateIfEmpty();
160 };
161 
167 class DAAL_EXPORT Result : public layers::forward::Result
168 {
169 public:
170  DECLARE_SERIALIZABLE_CAST(Result);
171 
175  Result();
176 
177  virtual ~Result() {}
178 
182  using layers::forward::Result::get;
183 
187  using layers::forward::Result::set;
188 
197  template <typename algorithmFPType>
198  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input,
199  const daal::algorithms::Parameter *parameter, const int method);
200 
205  virtual const services::Collection<size_t> getValueSize(const services::Collection<size_t> &inputSize,
206  const daal::algorithms::Parameter *par, const int method) const DAAL_C11_OVERRIDE;
207 
215  virtual services::Collection<size_t> getValueSize(const services::Collection< services::Collection<size_t> > &inputSize,
216  const daal::algorithms::Parameter *parameter, const int method) DAAL_C11_OVERRIDE;
217 
223  data_management::TensorPtr get(LayerDataId id) const;
224 
230  data_management::NumericTablePtr get(LayerDataNumericTableId id) const;
231 
237  void set(LayerDataId id, const data_management::TensorPtr &value);
238 
244  void set(LayerDataNumericTableId id, const data_management::NumericTablePtr &value);
245 
252  virtual services::Status setResultForBackward(const daal::algorithms::Input *input) DAAL_C11_OVERRIDE;
253 
262  virtual services::Status check(const daal::algorithms::Input *input,
263  const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
264 
265 protected:
267  template<typename Archive, bool onDeserialize>
268  services::Status serialImpl(Archive *arch)
269  {
270  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
271  }
272 
273 private:
276  services::Status checkValue(const Input *input) const;
277  services::Status checkAuxCoefficients(const Input *input) const;
278  services::Status checkAuxNumberOfCoefficients(const Input *input) const;
279 
280  LayerDataPtr getResultLayerDataAllocateIfEmpty();
281 
282  template<typename algorithmFPType>
283  services::Status allocateValueTensor(const Input *eltwiseInput);
284 };
285 
286 typedef services::SharedPtr<Result> ResultPtr;
287 } // namespace interface1
288 
289 using interface1::Input;
290 using interface1::Result;
291 using interface1::ResultPtr;
292 
293 } // namespace forward
295 } // namespace eltwise_sum
296 } // namespace layers
297 } // namespace neural_networks
298 } // namespace algorithms
299 } // namespace daal
300 
301 #endif
daal
Definition: algorithm_base_common.h:31
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:167
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:75
daal_defines.h
daal::algorithms::neural_networks::layers::eltwise_sum::forward::coefficients
Definition: eltwise_sum_layer_forward_types.h:61
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:72
daal::algorithms::math::abs::value
Definition: abs_types.h:86
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:61
daal::algorithms::neural_networks::layers::eltwise_sum::forward::InputId
InputId
Definition: eltwise_sum_layer_forward_types.h:59
daal::algorithms::neural_networks::layers::forward::InputLayerDataId
InputLayerDataId
Definition: layer_forward_types.h:73

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