3#if _MSC_VER >= 1900 && defined(_M_X64)
5#include "BackendBase.h"
13 class CCuda_ComputationalGraphSoftmax_CudnnWithCrossEntropy;
17 class FL_EXPORT CTensor;
20 class FL_EXPORT CBackendSoftmaxWithCrossEntropy :
public CBackendBase<T>
23 CBackendSoftmaxWithCrossEntropy();
24 CBackendSoftmaxWithCrossEntropy(
const CBackendSoftmaxWithCrossEntropy<T>& bl);
25 virtual ~CBackendSoftmaxWithCrossEntropy();
27 virtual const CResult SoftmaxWithCrossEntropy_Forward(
const CTensor<T>* pTsrX,
const CTensor<T>* pTsrTarget, CTensor<T>* pTsrResult, CTensor<T>& tsrSoftmaxBuffer, CTensor<T>& pTsrTargetBuffer,
const CTensor<T>* pTsrWeightOrNull =
nullptr, EReductionType eReductionType = EReductionType_Mean, T tLabelSmoothingValue = 0, int64_t i64IgnoreIndex = -1);
28 virtual const CResult SoftmaxWithCrossEntropy_Backward(
const CTensor<T>* pTsrX,
const CTensor<T>* pTsrTarget,
const CTensor<T>* pTsrDy, CTensor<T>* pTsrDx,
const CTensor<T>& tsrSoftmaxBuffer,
const CTensor<T>& pTsrTargetBuffer,
const CTensor<T>* pTsrWeightOrNull =
nullptr, EReductionType eReductionType = EReductionType_Mean, T tLabelSmoothingValue = 0, int64_t i64IgnoreIndex = -1);
31 virtual const CResult SoftmaxWithCrossEntropy(
const CTensor<T>* pTsrX,
const CTensor<T>* pTsrTarget, CTensor<T>* pTsrResult, CTensor<T>& tsrSoftmaxBuffer, CTensor<T>& tsrTargetBuffer,
const CTensor<T>* pTsrWeightOrNull, EReductionType eReductionType, T tLabelSmoothingValue, int64_t i64IgnoreIndex, T tDominatorValue);
32 virtual const CResult OneHotEncoding(
const CTensor<T>* pTsrTarget, CTensor<T>* pTsrResult, int64_t i64Ch, int64_t i64IgnoreIndex);
33 virtual const CResult LabelSmoothing(
const CTensor<T>* pTsrTarget, CTensor<T>* pTsrResult,
const T tSmoothingVal);
34 virtual T CalculateDominatorValue(
const CTensor<T>* pTsrOperand,
const CTensor<T>* pTsrTarget,
const CTensor<T>* pTsrWeightOrNull, EReductionType eReducntionType, int64_t i64IgnoreIndex);
35 virtual const CResult ApplyIgnoreIndex(
const CTensor<T>* pTsrTargetLongType, CTensor<T>* pTsrTargetOneHotEncoded, int64_t i64IgnoreIndex);
37 DeclareGetClassType();
38 SupportToDuplicateObjectWithoutCreateNewObject(CBackendSoftmaxWithCrossEntropy<T>, *
this);
41 CCuda_ComputationalGraphSoftmax_CudnnWithCrossEntropy<T>* m_pCudnn;