text: #ifndef CAFFE_RANDOM_SHUFFLE_LAYER_HPP_
  #define CAFFE_RANDOM_SHUFFLE_LAYER_HPP_
  
  #include <vector>
  
  #include "caffe/blob.hpp"
  #include "caffe/layer.hpp"
  #include "caffe/proto/caffe.pb.h"
  
  namespace caffe {
  
  /**
   * @brief Randomly shuffle the data distributions within a blob on a certain dimension (n, ch, h or w)
   */
  template <typename Dtype>
  class RandomShuffleLayer: public Layer<Dtype> {
   public:
    explicit RandomShuffleLayer(const LayerParameter& param)
        : Layer<Dtype>(param) {}
    virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
        const vector<Blob<Dtype>*>& top);
    virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
        const vector<Blob<Dtype>*>& top);
  
    virtual inline const char* type() const { return "RandomShuffle"; }
    // Scale
    virtual inline int MinBottomBlobs() const { return 1; }
    virtual inline int MaxBottomBlobs() const { return -1; }
    virtual inline int MinTopBlobs() const { return 1; }
    virtual inline int MaxTopBlobs() const { return -1;}
    virtual inline bool EqualNumBottomTopBlobs() const { return true; }
  
   protected:
    virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
        const vector<Blob<Dtype>*>& top);
    virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
        const vector<Blob<Dtype>*>& top);
    virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
        const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
    virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
        const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
  
    Blob<Dtype> swap_buffer_;
    
    int axis_;
    int spatial_dim_, scale_dim_, inner_dim_;
  };
  
  
  }  // namespace caffe
  
  #endif  // CAFFE_RANDOM_SHUFFLE_LAYER_HPP_
  