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

layer_backward.h
1 /* file: layer_backward.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 layer.
19 //--
20 */
21 
22 #ifndef __LAYER_BACKWARD_H__
23 #define __LAYER_BACKWARD_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "data_management/data/tensor.h"
27 #include "services/daal_defines.h"
28 #include "algorithms/neural_networks/layers/layer_backward_types.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
37 namespace neural_networks
38 {
42 namespace layers
43 {
47 namespace backward
48 {
49 namespace interface1
50 {
59 class LayerIface : public daal::algorithms::Analysis<batch>
60 {
61 public:
62  typedef algorithms::neural_networks::layers::backward::Input InputType;
63  typedef algorithms::neural_networks::layers::Parameter ParameterType;
64  typedef algorithms::neural_networks::layers::backward::Result ResultType;
65 
66  virtual ~LayerIface() {};
67 
72  virtual backward::ResultPtr getLayerResult() = 0;
73 
78  virtual InputType *getLayerInput() = 0;
79 
84  virtual ParameterType *getLayerParameter() = 0;
85 
91  services::SharedPtr<daal::algorithms::neural_networks::layers::backward::interface1::LayerIface> clone() const
92  {
93  return services::SharedPtr<LayerIface>(cloneImpl());
94  }
95 
99  virtual services::Status allocateResult() = 0;
100 
110  virtual services::Status addInput(backward::ResultPtr result, size_t resultIndex, size_t inputIndex) = 0;
111 
112 protected:
113  virtual LayerIface *cloneImpl() const = 0;
114 };
115 
116 typedef services::SharedPtr<LayerIface> LayerIfacePtr;
127 class LayerIfaceImpl : public LayerIface
128 {
129 public:
130  typedef LayerIface super;
131 
132  typedef super::InputType InputType;
133  typedef super::ParameterType ParameterType;
134  typedef super::ResultType ResultType;
135 
136  virtual ~LayerIfaceImpl() {};
137 
141  virtual services::Status addInput(backward::ResultPtr result, size_t resultIndex, size_t inputIndex) DAAL_C11_OVERRIDE
142  {
143  return getLayerInput()->addInputGradient(result->getGradient(resultIndex), inputIndex);
144  }
145 };
146 
147 typedef services::SharedPtr<LayerIfaceImpl> LayerIfaceImplPtr;
149 } // namespace interface1
150 
151 using interface1::LayerIface;
152 using interface1::LayerIfacePtr;
153 using interface1::LayerIfaceImpl;
154 using interface1::LayerIfaceImplPtr;
155 } // namespace backward
156 } // namespace layers
157 } // namespace neural_networks
158 } // namespace algorithms
159 } // namespace daal
160 #endif
daal::algorithms::neural_networks::layers::backward::interface1::LayerIface::addInput
virtual services::Status addInput(backward::ResultPtr result, size_t resultIndex, size_t inputIndex)=0
daal::algorithms::neural_networks::layers::backward::interface1::LayerIfaceImpl
Implements the abstract interface LayerIface. LayerIfaceImpl is, in turn, the base class for the clas...
Definition: layer_backward.h:127
daal::algorithms::neural_networks::layers::backward::interface1::LayerIfaceImpl::addInput
virtual services::Status addInput(backward::ResultPtr result, size_t resultIndex, size_t inputIndex) DAAL_C11_OVERRIDE
Definition: layer_backward.h:141
daal
Definition: algorithm_base_common.h:31
daal::algorithms::neural_networks::layers::backward::interface1::LayerIface
Abstract class which defines interface for the layer.
Definition: layer_backward.h:59
daal_defines.h
daal::algorithms::neural_networks::layers::interface1::LayerIface
Abstract class that specifies the interface of layer.
Definition: layer.h:57
daal::algorithms::neural_networks::layers::backward::interface1::LayerIface::getLayerParameter
virtual ParameterType * getLayerParameter()=0
daal::algorithms::neural_networks::layers::interface1::LayerIfacePtr
services::SharedPtr< LayerIface > LayerIfacePtr
Definition: layer.h:64
daal::algorithms::neural_networks::layers::backward::interface1::LayerIface::clone
services::SharedPtr< daal::algorithms::neural_networks::layers::backward::interface1::LayerIface > clone() const
Definition: layer_backward.h:91
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::algorithms::neural_networks::layers::backward::interface1::LayerIface::getLayerResult
virtual backward::ResultPtr getLayerResult()=0
daal::algorithms::neural_networks::layers::backward::interface1::LayerIface::allocateResult
virtual services::Status allocateResult()=0
daal::algorithms::neural_networks::layers::backward::interface1::LayerIface::getLayerInput
virtual InputType * getLayerInput()=0

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