#ifndef FBA_GROUP_H_
#define FBA_GROUP_H_
#include "tensorOperate.h"
#include "fullConnectLayer.h"
#include "biasLayer.h"
#include "batchNormLayer.h"
#include "activeLayer.h"

class FBAGroupLayer : public TensorOperate
{
    public:
        FBAGroupLayer();
        
        FBAGroupLayer(int ifType, int iID, int iMaxSeqNum, DevicesBatchDisptach *iDevicesBatchDisptach, int inOutputNum, \
                      float iLambda, float iAlpha, float lb, float ld, int ls, const char *inFunTypeStr);
                      
        FBAGroupLayer(int ifType, int iID, int iMaxSeqNum, DevicesBatchDisptach *iDevicesBatchDisptach, \
                      int inOutputNum, float iLambda, float iAlpha, float lb, float ld, int ls);     
                      
        void SetLayerConfig(int ifType, int iID, int iMaxSeqNum, DevicesBatchDisptach *iDevicesBatchDisptach, \
                            int inOutputNum, float iLambda, float iAlpha, float lb, float ld, int ls, const char* inFunTypeStr);
                            
        void SetLayerConfig(int ifType, int iID, int iMaxSeqNum, DevicesBatchDisptach *iDevicesBatchDisptach, \
                            int inOutputNum, float iLambda, float iAlpha, float lb, float ld, int ls);                    
                            
        virtual ~FBAGroupLayer();
        void ComputeAndCreateOutYInDTensorInfo();
        void CompuateOutY(int devID, int seqNum);
        void CompuateOutD(int devID, int seqNum);
        void SaveLayerWeight(int n);
        void UpdateWeightMain();
        void LoadLayerWeight();
        void ComputerYMemRealease(int devID);
        void ComputerDMemRealease(int devID);
        void CreateParaAndInstance();

private:
        void RealeaseSubLayesInstance();
        void SetYDSaveInfo();
        FCLayer *mFCLayer;
        BiasLayer *mBiasLayer;
        BatchNormLayer *mBatchNormLayer;
        ActiveLayer *mActiveLayer;
        int inputNum;
        int outputNum;
};

#endif
