#ifndef RES_GROUP_H_
#define RES_GROUP_H_
#include "tensorOperate.h"
#include "cbaGroupLayer.h"

class ResUnitLayer : public TensorOperate
{
    public:
        ResUnitLayer();
        ResUnitLayer(int ifType, int iID, int iMaxSeqNum, DevicesBatchDisptach *iDevicesBatchDisptach, float initGamma, \
                     float initBeta, float iLambda, float iAlpha, float lb, float ld, int ls, const char *inFunTypeStr);                                            
                            
        virtual ~ResUnitLayer();
        void ComputeAndCreateOutYInDTensorInfo();
        void CompuateOutY(int devID, int seqNum);
        void CompuateOutD(int devID, int seqNum);
        void UpdateWeightMain();
        void SaveLayerWeight(int n);
        void LoadLayerWeight();
        void ComputerYMemRealease(int devID);
        void ComputerDMemRealease(int devID);
        void CreateParaAndInstance();
        void SetLayerConfig(int ifType, int iID, int iMaxSeqNum, DevicesBatchDisptach *iDevicesBatchDisptach, float initGamma, \
                            float initBeta, float iLambda, float iAlpha, float lb, float ld, int ls, const char *inFunTypeStr);  
                            
     private:
        void RealeaseSubLayesInstance();
        void SetYDSaveInfo();
        void CreateSelfNet(int kNum);
        CBAGroupLayer *mFCBALayer;
        CBAGroupLayer *mBCBALayer;
        float mInitGamma; 
        float mInitBeta;
        float mLambda; 
        float mAlpha;
        float mLb;
        float mLd; 
        int mLs;
        char mAcType[16];
        int inChannels, inHeight, inWidth;
        int outChannels, outHeight, outWidth;
};

#endif
