23 #ifndef __NEURAL_NETWORKS_TRAINING_H__
24 #define __NEURAL_NETWORKS_TRAINING_H__
26 #include "algorithms/algorithm.h"
28 #include "services/daal_defines.h"
29 #include "algorithms/neural_networks/neural_networks_types.h"
30 #include "algorithms/neural_networks/neural_networks_training_types.h"
31 #include "algorithms/neural_networks/neural_networks_training_model.h"
32 #include "algorithms/neural_networks/layers/layer.h"
41 namespace neural_networks
56 template<
typename algorithmFPType, Method method, CpuType cpu>
57 class DAAL_EXPORT BatchContainer :
public TrainingContainerIface<batch>
65 BatchContainer(daal::services::Environment::env *daalEnv);
71 services::Status compute() DAAL_C11_OVERRIDE;
72 services::Status setupCompute() DAAL_C11_OVERRIDE;
73 services::Status resetCompute() DAAL_C11_OVERRIDE;
91 template<
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
92 class Batch :
public daal::algorithms::Training<batch>
95 typedef algorithms::neural_networks::training::Input InputType;
96 typedef algorithms::neural_networks::training::Parameter ParameterType;
97 typedef algorithms::neural_networks::training::Result ResultType;
100 Batch(services::SharedPtr<optimization_solver::iterative_solver::Batch > optimizationSolver_) : parameter(optimizationSolver_)
110 Batch(
const Batch<algorithmFPType, method> &other) : parameter(other.parameter), input(other.input)
124 services::Status initialize(
const services::Collection<size_t> &sampleSize,
const training::Topology &topology)
126 ResultPtr result = getResult();
127 if (!result || !result->get(neural_networks::training::model))
129 return services::Status(services::ErrorNullModel);
131 _result->get(neural_networks::training::model)->initialize<algorithmFPType>(sampleSize, topology, parameter);
132 return services::Status();
139 ResultPtr getResult()
150 services::Status setResult(
const ResultPtr& res)
152 DAAL_CHECK(res, services::ErrorNullResult)
154 _res = _result.get();
155 return services::Status();
163 services::SharedPtr<Batch<algorithmFPType, method> > clone()
const
165 return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
172 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int) method; }
175 ParameterType parameter;
180 Training<batch>::_ac =
new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
183 _result.reset(
new ResultType());
186 virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
188 return new Batch<algorithmFPType, method>(*this);
191 virtual services::Status allocateResult() DAAL_C11_OVERRIDE
193 services::Status s = _result->allocate<algorithmFPType>(&input, ¶meter, (int) method);
194 _res = _result.get();
203 using interface1::Batch;
204 using interface1::BatchContainer;
daal::algorithms::neural_networks::training::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: neural_networks_training.h:163
daal::algorithms::neural_networks::training::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: neural_networks_training.h:110
daal
Definition: algorithm_base_common.h:31
daal::algorithms::neural_networks::training::interface1::Batch::parameter
ParameterType parameter
Definition: neural_networks_training.h:175
daal::algorithms::neural_networks::training::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: neural_networks_training.h:172
daal::algorithms::neural_networks::training::interface1::Batch::Batch
Batch(services::SharedPtr< optimization_solver::iterative_solver::Batch > optimizationSolver_)
Definition: neural_networks_training.h:100
daal::algorithms::neural_networks::training::interface1::BatchContainer
Class containing methods to train neural network model using algorithmFPType precision arithmetic...
Definition: neural_networks_training.h:57
daal::algorithms::neural_networks::training::interface1::Batch
Provides methods for neural network model-based training in the batch processing mode.
Definition: neural_networks_training.h:92
daal::batch
Definition: daal_defines.h:110
daal::algorithms::neural_networks::training::interface1::Batch::getResult
ResultPtr getResult()
Definition: neural_networks_training.h:139
daal::algorithms::neural_networks::training::interface1::Batch::input
InputType input
Definition: neural_networks_training.h:174
daal::services::ErrorNullModel
Definition: error_indexes.h:83
daal::algorithms::neural_networks::training::interface1::Batch::initialize
services::Status initialize(const services::Collection< size_t > &sampleSize, const training::Topology &topology)
Definition: neural_networks_training.h:124
daal::algorithms::neural_networks::training::model
Definition: neural_networks_training_result.h:52
daal::algorithms::neural_networks::training::interface1::Batch::setResult
services::Status setResult(const ResultPtr &res)
Definition: neural_networks_training.h:150
daal::services::ErrorNullResult
Definition: error_indexes.h:96
daal::algorithms::TrainingContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the model...
Definition: training.h:50
daal::algorithms::Training
Provides methods to train models that depend on the data provided. For example, these methods enable ...
Definition: training.h:60