FLImaging 6.5.16.1
ComputationalGraphCELU.h
1#pragma once
2
3#if _MSC_VER >= 1900 && defined(_M_X64)
4
5#include "ComputationalGraph.h"
6
7namespace FLImaging
8{
9 namespace AI
10 {
11 template <typename T>
12 class FL_EXPORT CComputationalGraphCELU : public CComputationalGraph<T>
13 {
14 private:
15 CComputationalGraphCELU();
16
17 protected:
18 CComputationalGraphCELU(const CComputationalGraphCELU<T>& cg);
19
20 public:
21 CComputationalGraphCELU(const CComputationalBase<T>& cbOperand, T tAlpha = (T)1., bool bInplace = false);
22 virtual ~CComputationalGraphCELU();
23
24 virtual CTensor<T>& Forward() override;
25 virtual CTensor<T>* Backward() override;
26 virtual CComputationalBase<T>* Clone() const override;
27
28 virtual const std::vector<int64_t>& GetEstimatedShape(bool bRecursive = true) const override;
29 virtual const CResult PrintNodeParamInfo() const override;
30
31 virtual const CResult GetBinaryData(Base::CFLData& fldBinary, bool bSuperClass = false, int32_t i32Version = -1, bool bDumpMode = false) const override;
32 virtual const CResult GetBinaryData(Base::CFLData* pFldBinary, bool bSuperClass = false, int32_t i32Version = -1, bool bDumpMode = false) const override;
33
34 virtual const CResult SetBinaryData(const Base::CFLData& fldBinary, int64_t* pI64Offset = nullptr) override;
35 virtual const CResult SetBinaryData(const Base::CFLData* pFldBinary, int64_t* pI64Offset = nullptr) override;
36
37
38 DeclareGetClassType();
39 SupportToDuplicateObjectWithoutCreateNewObject(CComputationalGraphCELU, *this);
40 protected:
41 virtual const CResult CELU(CTensor<T>* pTsrOperand, CTensor<T>* pTsrResult);
42
43 private:
44 T m_tAlpha;
45
46 public:
47 DeclareGetSignletonObject(CComputationalGraphCELU);
48 };
49
50
51 #define CCGFCELU(...) (*(new CComputationalGraphCELU<float>(__VA_ARGS__)))
52 #define CCGDCELU(...) (*(new CComputationalGraphCELU<double>(__VA_ARGS__)))
53
54 #define CCGTCELU(T, ...) (*(new CComputationalGraphCELU<T>(__VA_ARGS__)))
55 }
56}
57
58#endif