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

eltwise_sum_layer_backward_types.h
1 /* file: eltwise_sum_layer_backward_types.h */
2 /*******************************************************************************
3 * Copyright 2014-2020 Intel Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
17 
18 /*
19 //++
20 // Implementation of backward element-wise sum layer.
21 //--
22 */
23 
24 #ifndef __ELTWISE_SUM_LAYER_BACKWARD_TYPES_H__
25 #define __ELTWISE_SUM_LAYER_BACKWARD_TYPES_H__
26 
27 #include "algorithms/algorithm.h"
28 #include "services/daal_defines.h"
29 
30 #include "data_management/data/tensor.h"
31 
32 #include "algorithms/neural_networks/layers/layer_backward_types.h"
33 #include "algorithms/neural_networks/layers/eltwise_sum/eltwise_sum_layer_types.h"
34 
35 namespace daal
36 {
37 namespace algorithms
38 {
39 namespace neural_networks
40 {
41 namespace layers
42 {
43 namespace eltwise_sum
44 {
54 namespace backward
55 {
59 namespace interface1
60 {
61 
67 class DAAL_EXPORT Input : public layers::backward::Input
68 {
69 public:
70  typedef layers::backward::Input super;
75  Input();
76 
81  Input(const Input& other);
82 
83  /*
84  * \DAAL_DEPRECATED
85  */
86  virtual ~Input() {}
87 
91  using layers::backward::Input::get;
92 
96  using layers::backward::Input::set;
97 
104  DAAL_DEPRECATED data_management::TensorPtr get(LayerDataId id) const;
105 
112  DAAL_DEPRECATED data_management::NumericTablePtr get(LayerDataNumericTableId id) const;
113 
120  DAAL_DEPRECATED void set(LayerDataId id, const data_management::TensorPtr &value);
121 
128  DAAL_DEPRECATED void set(LayerDataNumericTableId id, const data_management::NumericTablePtr &value);
129 
138  DAAL_DEPRECATED services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
139 
146  DAAL_DEPRECATED size_t getNumberOfCoefficients() const;
147 
148 private:
149  /*
150  * \DAAL_DEPRECATED
151  */
152  DAAL_DEPRECATED size_t getNumberOfAuxCoefficientsFromTable() const;
153 
154  /*
155  * \DAAL_DEPRECATED
156  */
157  DAAL_DEPRECATED services::Status checkInputGradient() const;
158  /*
159  * \DAAL_DEPRECATED
160  */
161  DAAL_DEPRECATED services::Status checkAuxCoefficients() const;
162  /*
163  * \DAAL_DEPRECATED
164  */
165  DAAL_DEPRECATED services::Status checkAuxNumberOfCoefficients() const;
166 };
167 
172 class DAAL_EXPORT Result : public layers::backward::Result
173 {
174 public:
175  DECLARE_SERIALIZABLE_CAST(Result);
176 
180  Result();
181 
182  virtual ~Result() {}
183 
187  using layers::backward::Result::get;
188 
192  using layers::backward::Result::set;
193 
200  data_management::TensorPtr get(layers::backward::ResultLayerDataId id, size_t index) const;
201 
208  void set(layers::backward::ResultLayerDataId id, const data_management::TensorPtr &value, size_t index);
209 
215  virtual data_management::TensorPtr getGradient(size_t index) const DAAL_C11_OVERRIDE;
216 
225  template <typename algorithmFPType>
226  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input,
227  const daal::algorithms::Parameter *parameter, const int method);
228 
237  services::Status check(const daal::algorithms::Input *input,
238  const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
239 
244  virtual LayerResultLayout getLayout() const DAAL_C11_OVERRIDE;
245 
246 protected:
248  template<typename Archive, bool onDeserialize>
249  services::Status serialImpl(Archive *arch)
250  {
251  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
252  }
253 
254 private:
255  template<typename algorithmFPType>
256  services::Status allocateNewOutputTensors(const data_management::TensorPtr &inputGradient, size_t nOutputs);
257 
258  LayerDataPtr getResultLayerDataAllocateIfEmpty();
259 
260  void useInputGradientTensorAsOutput(const data_management::TensorPtr &inputGradient, size_t nOutputs);
261 
262  services::Status checkResultLayerData(const Input *input) const;
263  services::Status checkOutputGradients(const Input *input) const;
264 };
265 
266 typedef services::SharedPtr<Result> ResultPtr;
267 } // namespace interface1
268 
269 using interface1::Input;
270 using interface1::Result;
271 using interface1::ResultPtr;
272 
273 } // namespace backward
275 } // namespace eltwise_sum
276 } // namespace layers
277 } // namespace neural_networks
278 } // namespace algorithms
279 } // namespace daal
280 #endif
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:63
daal::algorithms::neural_networks::layers::eltwise_sum::backward::interface1::Input
Input objects for the backward element-wise sum layer
Definition: eltwise_sum_layer_backward_types.h:67
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:74
daal::algorithms::neural_networks::layers::eltwise_sum::backward::interface1::Result
Results obtained with the compute() method of the backward element-wise sum layer.
Definition: eltwise_sum_layer_backward_types.h:172
daal_defines.h
daal::algorithms::neural_networks::layers::backward::ResultLayerDataId
ResultLayerDataId
Definition: layer_backward_types.h:96
daal::algorithms::math::abs::value
Definition: abs_types.h:88
daal::algorithms::neural_networks::layers::LayerResultLayout
LayerResultLayout
Definition: layer_types.h:70

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