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

layer_forward_container_base.h
1 /* file: layer_forward_container_base.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 // Base container of neural network forward layer.
19 //--
20 */
21 
22 #ifndef __LAYER_FORWARD_CONTAINER_BASE_H__
23 #define __LAYER_FORWARD_CONTAINER_BASE_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_forward_types.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
37 namespace neural_networks
38 {
42 namespace layers
43 {
47 namespace forward
48 {
49 namespace interface1
50 {
60 class DAAL_EXPORT LayerContainerIfaceImpl : public AnalysisContainerIface<batch>
61 {
62 public:
63  LayerContainerIfaceImpl(daal::services::Environment::env *daalEnv = 0) : AnalysisContainerIface<batch>(daalEnv) {}
64 
68  virtual services::Status setupCompute()
69  {
70  return services::Status();
71  }
72 
73  virtual services::Status resetCompute()
74  {
75  return services::Status();
76  }
77 
81  virtual services::Status allocateInput();
82 
86  virtual services::Status initializeInput();
87 
88 protected:
89  virtual services::Status completeInput();
90 };
91 
106 template<ComputeMode mode,
107  typename sse2Container
108  DAAL_KERNEL_SSSE3_ONLY(typename ssse3Container)
109  DAAL_KERNEL_SSE42_ONLY(typename sse42Container)
110  DAAL_KERNEL_AVX_ONLY(typename avxContainer)
111  DAAL_KERNEL_AVX2_ONLY(typename avx2Container)
112  DAAL_KERNEL_AVX512_mic_ONLY(typename avx512_micContainer)
113  DAAL_KERNEL_AVX512_ONLY(typename avx512Container)
114  >
115 class DAAL_EXPORT AlgorithmDispatchLayerContainer : public LayerContainerIfaceImpl
116 {
117 public:
119  AlgorithmDispatchLayerContainer(daal::services::Environment::env *daalEnv);
120  virtual ~AlgorithmDispatchLayerContainer() { delete _cntr; }
121 
122  virtual services::Status compute() DAAL_C11_OVERRIDE
123  {
124  _cntr->setArguments(this->_in, this->_res, this->_par);
125  return _cntr->compute();
126  }
127 
128  virtual services::Status setupCompute() DAAL_C11_OVERRIDE
129  {
130  _cntr->setArguments(this->_in, this->_res, this->_par);
131  return _cntr->setupCompute();
132  }
133 
134  virtual services::Status resetCompute() DAAL_C11_OVERRIDE
135  {
136  return _cntr->resetCompute();
137  }
138 
139  virtual services::Status allocateInput() DAAL_C11_OVERRIDE
140  {
141  _cntr->setArguments(this->_in, this->_res, this->_par);
142  return _cntr->allocateInput();
143  }
144 
145  virtual services::Status initializeInput() DAAL_C11_OVERRIDE
146  {
147  _cntr->setArguments(this->_in, this->_res, this->_par);
148  return _cntr->initializeInput();
149  }
150 protected:
151  LayerContainerIfaceImpl *_cntr;
152 };
153 
154 #define __DAAL_ALGORITHM_LAYER_CONTAINER(ContainerTemplate, ...) \
155  layers::forward::AlgorithmDispatchLayerContainer<batch, \
156  ContainerTemplate<__VA_ARGS__, sse2> \
157  DAAL_KERNEL_SSSE3_CONTAINER(ContainerTemplate, __VA_ARGS__) \
158  DAAL_KERNEL_SSE42_CONTAINER(ContainerTemplate, __VA_ARGS__) \
159  DAAL_KERNEL_AVX_CONTAINER(ContainerTemplate, __VA_ARGS__) \
160  DAAL_KERNEL_AVX2_CONTAINER(ContainerTemplate, __VA_ARGS__) \
161  DAAL_KERNEL_AVX512_mic_CONTAINER(ContainerTemplate, __VA_ARGS__) \
162  DAAL_KERNEL_AVX512_CONTAINER(ContainerTemplate, __VA_ARGS__)>
163 
166 } // namespace interface1
167 
168 using interface1::AlgorithmDispatchLayerContainer;
169 using interface1::LayerContainerIfaceImpl;
170 
171 } // namespace forward
172 } // namespace layers
173 } // namespace neural_networks
174 } // namespace algorithms
175 } // namespace daal
176 #endif
daal
Definition: algorithm_base_common.h:31
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:53
daal_defines.h
daal::algorithms::neural_networks::layers::forward::interface1::AlgorithmDispatchLayerContainer::allocateInput
virtual services::Status allocateInput() DAAL_C11_OVERRIDE
Definition: layer_forward_container_base.h:139
daal::algorithms::neural_networks::layers::forward::interface1::AlgorithmDispatchLayerContainer::setupCompute
virtual services::Status setupCompute() DAAL_C11_OVERRIDE
Definition: layer_forward_container_base.h:128
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:115
daal::algorithms::neural_networks::layers::forward::interface1::LayerContainerIfaceImpl::setupCompute
virtual services::Status setupCompute()
Definition: layer_forward_container_base.h:68
daal::algorithms::neural_networks::layers::forward::interface1::AlgorithmDispatchLayerContainer::initializeInput
virtual services::Status initializeInput() DAAL_C11_OVERRIDE
Definition: layer_forward_container_base.h:145
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:60
daal::ComputeMode
ComputeMode
Definition: daal_defines.h:104

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