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

layer_forward_container_base.h
1 /* file: layer_forward_container_base.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 // Base container of neural network forward layer.
21 //--
22 */
23 
24 #ifndef __LAYER_FORWARD_CONTAINER_BASE_H__
25 #define __LAYER_FORWARD_CONTAINER_BASE_H__
26 
27 #include "algorithms/algorithm.h"
28 #include "data_management/data/tensor.h"
29 #include "services/daal_defines.h"
30 #include "algorithms/neural_networks/layers/layer_forward_types.h"
31 
32 namespace daal
33 {
34 namespace algorithms
35 {
39 namespace neural_networks
40 {
44 namespace layers
45 {
49 namespace forward
50 {
51 namespace interface1
52 {
63 class DAAL_EXPORT LayerContainerIfaceImpl : public AnalysisContainerIface<batch>
64 {
65 public:
66  /*
67  * \DAAL_DEPRECATED
68  */
69  DAAL_DEPRECATED LayerContainerIfaceImpl(daal::services::Environment::env *daalEnv = 0) : AnalysisContainerIface<batch>(daalEnv) {}
70 
75  DAAL_DEPRECATED_VIRTUAL virtual services::Status setupCompute()
76  {
77  return services::Status();
78  }
79 
80  /*
81  * \DAAL_DEPRECATED
82  */
83  DAAL_DEPRECATED_VIRTUAL virtual services::Status resetCompute()
84  {
85  return services::Status();
86  }
87 
92  DAAL_DEPRECATED_VIRTUAL virtual services::Status allocateInput();
93 
98  DAAL_DEPRECATED_VIRTUAL virtual services::Status initializeInput();
99 
100 protected:
101  /*
102  * \DAAL_DEPRECATED
103  */
104  DAAL_DEPRECATED_VIRTUAL virtual services::Status completeInput();
105 };
106 
122 template<ComputeMode mode,
123  typename sse2Container
124  DAAL_KERNEL_SSSE3_ONLY(typename ssse3Container)
125  DAAL_KERNEL_SSE42_ONLY(typename sse42Container)
126  DAAL_KERNEL_AVX_ONLY(typename avxContainer)
127  DAAL_KERNEL_AVX2_ONLY(typename avx2Container)
128  DAAL_KERNEL_AVX512_MIC_ONLY(typename avx512_micContainer)
129  DAAL_KERNEL_AVX512_ONLY(typename avx512Container)
130  >
131 class DAAL_EXPORT AlgorithmDispatchLayerContainer : public LayerContainerIfaceImpl
132 {
133 public:
138  AlgorithmDispatchLayerContainer(daal::services::Environment::env *daalEnv);
139 
140  /*
141  * \DAAL_DEPRECATED
142  */
143  virtual ~AlgorithmDispatchLayerContainer() { delete _cntr; }
144 
145  /*
146  * \DAAL_DEPRECATED
147  */
148  DAAL_DEPRECATED_VIRTUAL virtual services::Status compute() DAAL_C11_OVERRIDE
149  {
150  _cntr->setArguments(this->_in, this->_res, this->_par);
151  return _cntr->compute();
152  }
153 
154  /*
155  * \DAAL_DEPRECATED
156  */
157  DAAL_DEPRECATED_VIRTUAL virtual services::Status setupCompute() DAAL_C11_OVERRIDE
158  {
159  _cntr->setArguments(this->_in, this->_res, this->_par);
160  return _cntr->setupCompute();
161  }
162 
163  /*
164  * \DAAL_DEPRECATED
165  */
166  DAAL_DEPRECATED_VIRTUAL virtual services::Status resetCompute() DAAL_C11_OVERRIDE
167  {
168  return _cntr->resetCompute();
169  }
170 
171  /*
172  * \DAAL_DEPRECATED
173  */
174  DAAL_DEPRECATED_VIRTUAL virtual services::Status allocateInput() DAAL_C11_OVERRIDE
175  {
176  _cntr->setArguments(this->_in, this->_res, this->_par);
177  return _cntr->allocateInput();
178  }
179 
180  /*
181  * \DAAL_DEPRECATED
182  */
183  DAAL_DEPRECATED_VIRTUAL virtual services::Status initializeInput() DAAL_C11_OVERRIDE
184  {
185  _cntr->setArguments(this->_in, this->_res, this->_par);
186  return _cntr->initializeInput();
187  }
188 protected:
189  LayerContainerIfaceImpl *_cntr;
190 };
191 
192 #define __DAAL_ALGORITHM_LAYER_CONTAINER(ContainerTemplate, ...) \
193  layers::forward::AlgorithmDispatchLayerContainer<batch, \
194  ContainerTemplate<__VA_ARGS__, sse2> \
195  DAAL_KERNEL_SSSE3_CONTAINER(ContainerTemplate, __VA_ARGS__) \
196  DAAL_KERNEL_SSE42_CONTAINER(ContainerTemplate, __VA_ARGS__) \
197  DAAL_KERNEL_AVX_CONTAINER(ContainerTemplate, __VA_ARGS__) \
198  DAAL_KERNEL_AVX2_CONTAINER(ContainerTemplate, __VA_ARGS__) \
199  DAAL_KERNEL_AVX512_MIC_CONTAINER(ContainerTemplate, __VA_ARGS__) \
200  DAAL_KERNEL_AVX512_CONTAINER(ContainerTemplate, __VA_ARGS__)>
201 
204 } // namespace interface1
205 
206 using interface1::AlgorithmDispatchLayerContainer;
207 using interface1::LayerContainerIfaceImpl;
208 
209 } // namespace forward
210 } // namespace layers
211 } // namespace neural_networks
212 } // namespace algorithms
213 } // namespace daal
214 #endif
daal::algorithms::neural_networks::layers::forward::interface1::AlgorithmDispatchLayerContainer
Implements a container to dispatch forward layers to cpu-specific implementations.
Definition: layer_forward_container_base.h:131
daal::algorithms::neural_networks::layers::forward::interface1::LayerContainerIfaceImpl
Provides methods of base container for forward layers. This class is associated with the daal::algori...
Definition: layer_forward_container_base.h:63
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:55
daal_defines.h
daal::algorithms::neural_networks::layers::forward::interface1::AlgorithmDispatchLayerContainer::setupCompute
virtual DAAL_DEPRECATED_VIRTUAL services::Status setupCompute() DAAL_C11_OVERRIDE
Definition: layer_forward_container_base.h:157
daal::ComputeMode
ComputeMode
Definition: daal_defines.h:110
daal::algorithms::neural_networks::layers::forward::interface1::AlgorithmDispatchLayerContainer::allocateInput
virtual DAAL_DEPRECATED_VIRTUAL services::Status allocateInput() DAAL_C11_OVERRIDE
Definition: layer_forward_container_base.h:174
daal::algorithms::neural_networks::layers::forward::interface1::LayerContainerIfaceImpl::setupCompute
virtual DAAL_DEPRECATED_VIRTUAL services::Status setupCompute()
Definition: layer_forward_container_base.h:75
daal::algorithms::neural_networks::layers::forward::interface1::AlgorithmDispatchLayerContainer::initializeInput
virtual DAAL_DEPRECATED_VIRTUAL services::Status initializeInput() DAAL_C11_OVERRIDE
Definition: layer_forward_container_base.h:183

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