#ifndef LCF_SOFTMAX_LOST_VEC_H_
#define LCF_SOFTMAX_LOST_VEC_H_
#include "tensorOperate.h"

// SoftmaxVec
class SoftMaxLostVecLayer : public TensorOperate
{
    public:
        SoftMaxLostVecLayer();
        SoftMaxLostVecLayer(int ifType, int iID, int iMaxSeqNum, DevicesBatchDisptach *iDevicesBatchDisptach, SLTYPE lossType);
        void SetLayerConfig(int ifType, int iID, int iMaxSeqNum, DevicesBatchDisptach *iDevicesBatchDisptach, SLTYPE lossType);
        virtual ~SoftMaxLostVecLayer();
        void ComputeAndCreateOutYInDTensorInfo();
        void CompuateOutY(int devID, int seqNum);
        void CompuateOutD(int devID, int seqNum);
        void InitParaValue();
        void InputTrainLabelData(float *inLabelData);
        void SaveLayerWeight(int n);
        void LoadLayerWeight();
        float GetThisBatchAveLost();
        void GetPredictType(int *outType);
        void GetPredictProbability(float *outPab);
        void SetLostType(SLTYPE lossType);
        int GetIfNormIn();
        float ComputeDOutByDInRetLost(int devID, MyVoid *resultDCMem, MyVoid *outY, int i);
        void ComputerYMemRealease(int devID);
        void ComputerDMemRealease(int devID);
        void CreateParaAndInstance();

        TensorData *GetLabelData(int devID, int seqNum);
        TensorData *GetMaxVector(int devID, int seqNum);
        TensorData *GetVectorPab(int devID, int seqNum);

    private:
        void InputTrainLabelData(int *inLabelData, int len);
        void SetChildLayerMomeryPointInitStatus();
        void RealeaseChildLayerMemory();
        TensorData *mLabelData;                 // mLableData[seqNum][batchNum]
        TensorData *mMaxVector;                 // mMaxVector[seqNum][batchNum]
        TensorData *mVectorPab;                 // mMaxVectorPab[seqNum][batchNum]
        float *mLost;                           // total ave lost
        SLTYPE mLostType;                       // SL or FL ...
        int inChannels, inHeight, inWidth;
        int outChannels, outHeight, outWidth;
};

#endif
