23 #ifndef __CONVOLUTION2D_LAYER_FORWARD_H__
24 #define __CONVOLUTION2D_LAYER_FORWARD_H__
26 #include "algorithms/algorithm.h"
27 #include "data_management/data/tensor.h"
28 #include "services/daal_defines.h"
29 #include "algorithms/neural_networks/layers/layer.h"
30 #include "algorithms/neural_networks/layers/convolution2d/convolution2d_layer_types.h"
31 #include "algorithms/neural_networks/layers/convolution2d/convolution2d_layer_forward_types.h"
37 namespace neural_networks
41 namespace convolution2d
62 template<
typename algorithmFPType, Method method, CpuType cpu>
63 class DAAL_EXPORT BatchContainer :
public layers::forward::LayerContainerIfaceImpl
71 BatchContainer(daal::services::Environment::env *daalEnv);
79 services::Status compute() DAAL_C11_OVERRIDE;
80 services::Status setupCompute() DAAL_C11_OVERRIDE;
81 services::Status resetCompute() DAAL_C11_OVERRIDE;
83 virtual services::Status allocateInput() DAAL_C11_OVERRIDE
85 Input *input =
static_cast<Input *
>(_in);
86 return input->allocate<algorithmFPType>(_par, (int) method);
107 template<
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
108 class Batch :
public layers::forward::LayerIfaceImpl
111 typedef layers::forward::LayerIfaceImpl super;
113 typedef algorithms::neural_networks::layers::convolution2d::forward::Input InputType;
114 typedef algorithms::neural_networks::layers::convolution2d::Parameter ParameterType;
115 typedef algorithms::neural_networks::layers::convolution2d::forward::Result ResultType;
117 ParameterType ¶meter;
121 Batch() : parameter(_defaultParameter)
131 Batch(ParameterType& parameter) : parameter(parameter), _defaultParameter(parameter)
141 Batch(
const Batch<algorithmFPType, method> &other) : super(other),
142 _defaultParameter(other.parameter), parameter(_defaultParameter), input(other.input)
151 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int) method; }
157 virtual InputType *getLayerInput() DAAL_C11_OVERRIDE {
return &input; }
163 virtual ParameterType *getLayerParameter() DAAL_C11_OVERRIDE {
return ¶meter; };
169 layers::forward::ResultPtr getLayerResult() DAAL_C11_OVERRIDE
178 ResultPtr getResult()
189 services::Status setResult(
const ResultPtr& result)
191 DAAL_CHECK(result, services::ErrorNullResult)
193 _res = _result.get();
194 return services::Status();
202 services::SharedPtr<Batch<algorithmFPType, method> > clone()
const
204 return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
207 virtual services::Status allocateResult() DAAL_C11_OVERRIDE
209 services::Status s = this->_result->template allocate<algorithmFPType>(&(this->input), ¶meter, (
int) method);
210 this->_res = this->_result.get();
215 virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
217 return new Batch<algorithmFPType, method>(*this);
222 Analysis<batch>::_ac =
new __DAAL_ALGORITHM_LAYER_CONTAINER(BatchContainer, algorithmFPType, method)(&_env);
225 _result.reset(
new ResultType());
230 ParameterType _defaultParameter;
235 using interface1::BatchContainer;
236 using interface1::Batch;
daal
Definition: algorithm_base_common.h:31
daal::algorithms::neural_networks::layers::convolution2d::forward::interface1::Batch::getResult
ResultPtr getResult()
Definition: convolution2d_layer_forward.h:178
daal::algorithms::neural_networks::layers::convolution2d::forward::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: convolution2d_layer_forward.h:141
daal::algorithms::neural_networks::layers::convolution2d::forward::interface1::Batch::getLayerResult
layers::forward::ResultPtr getLayerResult() DAAL_C11_OVERRIDE
Definition: convolution2d_layer_forward.h:169
daal::algorithms::neural_networks::layers::convolution2d::forward::interface1::Batch::Batch
Batch(ParameterType ¶meter)
Definition: convolution2d_layer_forward.h:131
daal::algorithms::neural_networks::layers::convolution2d::forward::interface1::Batch::parameter
ParameterType & parameter
Definition: convolution2d_layer_forward.h:117
daal::algorithms::neural_networks::layers::convolution2d::forward::interface1::Batch::input
InputType input
Definition: convolution2d_layer_forward.h:118
daal::algorithms::neural_networks::layers::convolution2d::forward::interface1::Batch
Provides methods for forward 2D convolution layer computations in the batch processing mode...
Definition: convolution2d_layer_forward.h:108
daal::algorithms::neural_networks::layers::convolution2d::forward::interface1::Batch::Batch
Batch()
Definition: convolution2d_layer_forward.h:121
daal::algorithms::neural_networks::layers::convolution2d::forward::interface1::BatchContainer
Provides methods to run implementations of the forward 2D convolution layer. This class is associated...
Definition: convolution2d_layer_forward.h:63
daal::algorithms::neural_networks::layers::convolution2d::forward::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: convolution2d_layer_forward.h:151
daal::algorithms::neural_networks::layers::convolution2d::forward::interface1::Batch::setResult
services::Status setResult(const ResultPtr &result)
Definition: convolution2d_layer_forward.h:189
daal::algorithms::neural_networks::layers::convolution2d::forward::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: convolution2d_layer_forward.h:202
daal::algorithms::neural_networks::layers::convolution2d::forward::interface1::Batch::getLayerInput
virtual InputType * getLayerInput() DAAL_C11_OVERRIDE
Definition: convolution2d_layer_forward.h:157
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::services::ErrorNullResult
Definition: error_indexes.h:96
daal::algorithms::neural_networks::layers::convolution2d::forward::interface1::Batch::getLayerParameter
virtual ParameterType * getLayerParameter() DAAL_C11_OVERRIDE
Definition: convolution2d_layer_forward.h:163