FLImaging 6.5.16.1
BackendSoftmax.h
1#pragma once
2
3#if _MSC_VER >= 1900 && defined(_M_X64)
4
5#include "BackendBase.h"
6#include <vector>
7
8namespace FLImaging
9{
10 namespace AI
11 {
12 #ifdef CUDNN_MODE
13 template <typename T>
14 class CCuda_ComputationalGraphSoftmax_Cudnn;
15 #endif
16
17 template <typename T>
18 class FL_EXPORT CTensor;
19
20 template <typename T>
21 class FL_EXPORT CBackendSoftmax : public CBackendBase<T>
22 {
23 public:
24 CBackendSoftmax();
25 CBackendSoftmax(const CBackendSoftmax<T>& bl);
26 virtual ~CBackendSoftmax();
27
28 virtual const CResult SoftmaxCPU(const CTensor<T>* pTsrInput, CTensor<T>* pTsrResult, int64_t i64Axis);
29 virtual const CResult SoftmaxCuda(const CTensor<T>* pTsrInput, CTensor<T>* pTsrResult, int64_t i64Axis);
30
31 virtual const CResult SoftmaxBackwardCPU(const CTensor<T>* pTsrDy, const CTensor<T>* pTsrY, CTensor<T>* pTsrDx, int64_t i64Axis, bool bAddGradients = false);
32 virtual const CResult SoftmaxBackwardCuda(const CTensor<T>* pTsrDy, const CTensor<T>* pTsrY, CTensor<T>* pTsrDx, int64_t i64Axis, bool bAddGradients = false);
33
34 DeclareGetClassType();
35 SupportToDuplicateObjectWithoutCreateNewObject(CBackendSoftmax<T>, *this);
36
37 protected:
38 #ifdef CUDNN_MODE
39 CCuda_ComputationalGraphSoftmax_Cudnn<T>* m_cudnn;
40 #endif
41
42 };
43 }
44}
45
46#endif