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

layer_backward.h
1 /* file: layer_backward.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 layer.
45 //--
46 */
47 
48 #ifndef __LAYER_BACKWARD_H__
49 #define __LAYER_BACKWARD_H__
50 
51 #include "algorithms/algorithm.h"
52 #include "data_management/data/tensor.h"
53 #include "services/daal_defines.h"
54 #include "algorithms/neural_networks/layers/layer_backward_types.h"
55 
56 namespace daal
57 {
58 namespace algorithms
59 {
63 namespace neural_networks
64 {
68 namespace layers
69 {
73 namespace backward
74 {
75 namespace interface1
76 {
85 class LayerIface : public daal::algorithms::Analysis<batch>
86 {
87 public:
88  typedef algorithms::neural_networks::layers::backward::Input InputType;
89  typedef algorithms::neural_networks::layers::Parameter ParameterType;
90  typedef algorithms::neural_networks::layers::backward::Result ResultType;
91 
92  virtual ~LayerIface() {};
93 
98  virtual backward::ResultPtr getLayerResult() = 0;
99 
104  virtual InputType *getLayerInput() = 0;
105 
110  virtual ParameterType *getLayerParameter() = 0;
111 
117  services::SharedPtr<daal::algorithms::neural_networks::layers::backward::interface1::LayerIface> clone() const
118  {
119  return services::SharedPtr<LayerIface>(cloneImpl());
120  }
121 
125  virtual services::Status allocateResult() = 0;
126 
136  virtual services::Status addInput(backward::ResultPtr result, size_t resultIndex, size_t inputIndex) = 0;
137 
138 protected:
139  virtual LayerIface *cloneImpl() const = 0;
140 };
141 
142 typedef services::SharedPtr<LayerIface> LayerIfacePtr;
153 class LayerIfaceImpl : public LayerIface
154 {
155 public:
156  typedef LayerIface super;
157 
158  typedef super::InputType InputType;
159  typedef super::ParameterType ParameterType;
160  typedef super::ResultType ResultType;
161 
162  virtual ~LayerIfaceImpl() {};
163 
167  virtual services::Status addInput(backward::ResultPtr result, size_t resultIndex, size_t inputIndex) DAAL_C11_OVERRIDE
168  {
169  return getLayerInput()->addInputGradient(result->getGradient(resultIndex), inputIndex);
170  }
171 };
172 
173 typedef services::SharedPtr<LayerIfaceImpl> LayerIfaceImplPtr;
175 } // namespace interface1
176 
177 using interface1::LayerIface;
178 using interface1::LayerIfacePtr;
179 using interface1::LayerIfaceImpl;
180 using interface1::LayerIfaceImplPtr;
181 } // namespace backward
182 } // namespace layers
183 } // namespace neural_networks
184 } // namespace algorithms
185 } // namespace daal
186 #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:153
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:167
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::backward::interface1::LayerIface
Abstract class which defines interface for the layer.
Definition: layer_backward.h:85
daal::algorithms::neural_networks::layers::interface1::Parameter
Definition: layer_types.h:110
daal_defines.h
daal::algorithms::neural_networks::layers::backward::interface1::LayerIface::getLayerParameter
virtual ParameterType * getLayerParameter()=0
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::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:94
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:117
daal::algorithms::neural_networks::layers::backward::interface1::Input::addInputGradient
virtual services::Status addInputGradient(const data_management::TensorPtr &igTensor, size_t index)
daal::algorithms::neural_networks::layers::backward::interface1::Result
Provides methods to access the result obtained with the compute() method of the layer algorithm...
Definition: layer_backward_types.h:224
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
daal::algorithms::neural_networks::layers::backward::interface1::Input
Input parameters for the layer algorithm
Definition: layer_backward_types.h:150

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