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

class DropoutLayer : public TensorOperate
{
    public:
        DropoutLayer(int ifType, int iID, int iMaxSeqNum, DevicesBatchDisptach *iDevicesBatchDisptach, float inKeepProb);
        virtual ~DropoutLayer();
        void ComputeAndCreateOutYInDTensorInfo();
        void SaveLayerWeight(int n);
        void LoadLayerWeight();
        void CompuateOutY(int devID, int seqNum);
        void CompuateOutD(int devID, int seqNum);
        void ComputerYMemRealease(int devID);
        void ComputerDMemRealease(int devID);
        void CreateParaAndInstance();
        TensorData *GetNeuronPresent(int devID, int seqNum);

    private:
        void SetChildLayerMomeryPointInitStatus();
        void RealeaseChildLayerMemory();
        float keepProb;                            // keep probability
        TensorData *mNeuronPresent;                // mNeuronPresent[inChannels] = 0 then (1 - keepProb) drop; if 1 then keepProb exist
        int neuronPresentIndex;                    // index of global memory
        int inChannels, inHeight, inWidth;
        int outChannels, outHeight, outWidth;
};

#endif