24 #ifndef __LOSS_SOFTMAX_CROSS_LAYER_FORWARD_H__
25 #define __LOSS_SOFTMAX_CROSS_LAYER_FORWARD_H__
27 #include "algorithms/algorithm.h"
28 #include "services/daal_defines.h"
29 #include "algorithms/neural_networks/layers/layer.h"
30 #include "algorithms/neural_networks/layers/loss/loss_layer_forward.h"
31 #include "algorithms/neural_networks/layers/loss/softmax_cross_layer_types.h"
32 #include "algorithms/neural_networks/layers/loss/softmax_cross_layer_forward_types.h"
33 #include "algorithms/neural_networks/layers/softmax/softmax_layer_forward.h"
39 namespace neural_networks
45 namespace softmax_cross
68 template<
typename algorithmFPType, Method method, CpuType cpu>
69 class BatchContainer :
public layers::forward::LayerContainerIfaceImpl
78 DAAL_DEPRECATED BatchContainer(daal::services::Environment::env *daalEnv);
83 DAAL_DEPRECATED ~BatchContainer();
90 DAAL_DEPRECATED services::Status compute() DAAL_C11_OVERRIDE;
113 template<
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
114 class Batch :
public loss::forward::Batch
117 typedef loss::forward::Batch super;
119 typedef algorithms::neural_networks::layers::loss::softmax_cross::forward::Input InputType;
120 typedef algorithms::neural_networks::layers::loss::softmax_cross::Parameter ParameterType;
121 typedef algorithms::neural_networks::layers::loss::softmax_cross::forward::Result ResultType;
123 ParameterType ¶meter;
130 DAAL_DEPRECATED Batch() : parameter(_defaultParameter)
141 Batch(ParameterType& parameter) : parameter(parameter), _defaultParameter(parameter)
153 Batch(
const Batch<algorithmFPType, method> &other) : super(other),
154 _defaultParameter(other.parameter), parameter(_defaultParameter), input(other.input)
164 DAAL_DEPRECATED_VIRTUAL
virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int) method; }
171 DAAL_DEPRECATED_VIRTUAL
virtual InputType *getLayerInput() DAAL_C11_OVERRIDE {
return &input; }
178 DAAL_DEPRECATED_VIRTUAL
virtual ParameterType *getLayerParameter() DAAL_C11_OVERRIDE {
return ¶meter; };
185 DAAL_DEPRECATED layers::forward::ResultPtr getLayerResult() DAAL_C11_OVERRIDE
195 ResultPtr getResult()
207 DAAL_DEPRECATED services::Status setResult(
const ResultPtr& result)
209 DAAL_CHECK(result, services::ErrorNullResult)
211 _res = _result.get();
212 return services::Status();
222 DAAL_DEPRECATED services::SharedPtr<Batch<algorithmFPType, method> > clone()
const
224 return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
233 DAAL_DEPRECATED_VIRTUAL
virtual services::Status allocateResult() DAAL_C11_OVERRIDE
235 services::Status s = this->_result->template allocate<algorithmFPType>(&(this->input), ¶meter, (
int) method);
236 this->_res = this->_result.get();
245 DAAL_DEPRECATED_VIRTUAL
virtual layers::forward::LayerIfacePtr getLayerForPrediction() const DAAL_C11_OVERRIDE
247 return layers::forward::LayerIfacePtr(
248 new layers::softmax::forward::Batch<algorithmFPType>());
255 DAAL_DEPRECATED_VIRTUAL
virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
257 return new Batch<algorithmFPType, method>(*this);
265 Analysis<batch>::_ac =
new __DAAL_ALGORITHM_LAYER_CONTAINER(BatchContainer, algorithmFPType, method)(&_env);
268 _result.reset(
new ResultType());
273 ParameterType _defaultParameter;
277 using interface1::BatchContainer;
278 using interface1::Batch;
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::Batch::setResult
DAAL_DEPRECATED services::Status setResult(const ResultPtr &result)
Definition: softmax_cross_layer_forward.h:207
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::Batch::Batch
Batch(ParameterType ¶meter)
Definition: softmax_cross_layer_forward.h:141
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::Batch::getLayerParameter
virtual DAAL_DEPRECATED_VIRTUAL ParameterType * getLayerParameter() DAAL_C11_OVERRIDE
Definition: softmax_cross_layer_forward.h:178
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::Batch::allocateResult
virtual DAAL_DEPRECATED_VIRTUAL services::Status allocateResult() DAAL_C11_OVERRIDE
Definition: softmax_cross_layer_forward.h:233
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::Batch::getMethod
virtual DAAL_DEPRECATED_VIRTUAL int getMethod() const DAAL_C11_OVERRIDE
Definition: softmax_cross_layer_forward.h:164
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::Batch::getLayerResult
DAAL_DEPRECATED layers::forward::ResultPtr getLayerResult() DAAL_C11_OVERRIDE
Definition: softmax_cross_layer_forward.h:185
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::Batch::clone
DAAL_DEPRECATED services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: softmax_cross_layer_forward.h:222
daal::services::ErrorNullResult
Definition: error_indexes.h:98
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::Batch
Provides methods for the forward softmax cross layer in the batch processing mode.
Definition: softmax_cross_layer_forward.h:114
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::BatchContainer::compute
DAAL_DEPRECATED services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::Batch::getResult
ResultPtr getResult()
Definition: softmax_cross_layer_forward.h:195
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::Batch::parameter
ParameterType & parameter
Definition: softmax_cross_layer_forward.h:123
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: softmax_cross_layer_forward.h:153
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::Batch::Batch
DAAL_DEPRECATED Batch()
Definition: softmax_cross_layer_forward.h:130
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::Batch::input
InputType input
Definition: softmax_cross_layer_forward.h:124
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::BatchContainer::BatchContainer
DAAL_DEPRECATED BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:70
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::BatchContainer::~BatchContainer
DAAL_DEPRECATED ~BatchContainer()
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::Batch::getLayerInput
virtual DAAL_DEPRECATED_VIRTUAL InputType * getLayerInput() DAAL_C11_OVERRIDE
Definition: softmax_cross_layer_forward.h:171
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::Batch::getLayerForPrediction
virtual DAAL_DEPRECATED_VIRTUAL layers::forward::LayerIfacePtr getLayerForPrediction() const DAAL_C11_OVERRIDE
Definition: softmax_cross_layer_forward.h:245
daal::algorithms::neural_networks::layers::loss::softmax_cross::forward::interface1::BatchContainer
Provides methods to run implementations of the of the forward softmax cross-entropy layer This class ...
Definition: softmax_cross_layer_forward.h:69