InfogainLossLayerTest()
     : blob_bottom_data_(new Blob<Dtype>(4, 2, 1, 5, 2)),
       blob_bottom_label_(new Blob<Dtype>(4, 2, 1, 1, 2)),
       blob_bottom_infogain_(new Blob<Dtype>(1, 1, 1, 5, 5)),
       blob_top_loss_(new Blob<Dtype>()),
       blob_top_prob_(new Blob<Dtype>()),
       inner_(2), outer_(4*2), num_labels_(5) {
   Caffe::set_random_seed(1701);
   FillerParameter filler_param;
   filler_param.set_min(-0.5);
   filler_param.set_max(2.0);
   UniformFiller<Dtype> filler(filler_param);
   filler.Fill(this->blob_bottom_data_);
   blob_bottom_vec_.push_back(blob_bottom_data_);
   for (int i = 0; i < blob_bottom_label_->count(); ++i) {
     blob_bottom_label_->mutable_cpu_data()[i] =
       caffe_rng_rand() % num_labels_;
   }
   blob_bottom_vec_.push_back(blob_bottom_label_);
   filler_param.set_min(0.1);
   filler_param.set_max(2.0);
   UniformFiller<Dtype> infogain_filler(filler_param);
   infogain_filler.Fill(this->blob_bottom_infogain_);
   blob_bottom_vec_.push_back(blob_bottom_infogain_);
   blob_top_vec_.push_back(blob_top_loss_);
   blob_top_vec_.push_back(blob_top_prob_);
 }
	void InfogainLossLayerTestForwardPerformance(int num_images, int num_channels, int im_width, int im_height) {

		typedef typename TypeParam::Dtype Dtype;
		LayerParameter layer_param;
		InfogainLossLayer<Dtype> layer(layer_param);

		blob_bottom_data_->Reshape(num_images, num_channels, 1, 1);
		blob_bottom_label_->Reshape(num_images, 1, 1, 1);
		blob_bottom_infogain_->Reshape(1, 1, num_channels, num_channels);

		FillerParameter filler_param;
		UniformFiller<Dtype> filler(filler_param);
		filler.Fill(this->blob_bottom_data_);

		for (int i = 0; i < blob_bottom_label_->count(); ++i) {
			blob_bottom_label_->mutable_cpu_data()[i] = caffe_rng_rand() % 5;
		}

		filler_param.set_min(0.1);
		filler_param.set_max(2.0);
		UniformFiller<Dtype> infogain_filler(filler_param);
		infogain_filler.Fill(this->blob_bottom_infogain_);

		blob_bottom_vec_.clear();
		blob_bottom_vec_.push_back(blob_bottom_data_);
		blob_bottom_vec_.push_back(blob_bottom_label_);
		blob_bottom_vec_.push_back(blob_bottom_infogain_);

		layer.SetUp(this->blob_bottom_vec_, this->blob_top_vec_);

#if defined(USE_CUDA) || defined(USE_OPENCL)
		blob_bottom_data_->mutable_gpu_data();
		blob_bottom_data_->mutable_gpu_diff();
		blob_bottom_label_->mutable_gpu_data();
		blob_bottom_label_->mutable_gpu_diff();
		blob_bottom_infogain_->mutable_gpu_data();
		blob_bottom_infogain_->mutable_gpu_diff();
		blob_top_loss_->mutable_gpu_data();
		blob_top_loss_->mutable_gpu_diff();
#endif

		record r;
		r.type = std::string(typeid(Dtype).name());
		r.num_images = num_images;
		r.num_channels = num_channels;
		r.img_width = im_width;
		r.img_height = im_height;

		BENCH(r, {
			layer.Forward(this->blob_bottom_vec_, this->blob_top_vec_)
			;
		});
 InfogainLossLayerTest()
     : blob_bottom_data_(new Blob<Dtype>(10, 5, 1, 1)),
       blob_bottom_label_(new Blob<Dtype>(10, 1, 1, 1)),
       blob_bottom_infogain_(new Blob<Dtype>(1, 1, 5, 5)),
       blob_top_loss_(new Blob<Dtype>()) {
   Caffe::set_random_seed(1701);
   FillerParameter filler_param;
   PositiveUnitballFiller<Dtype> filler(filler_param);
   filler.Fill(this->blob_bottom_data_);
   blob_bottom_vec_.push_back(blob_bottom_data_);
   for (int i = 0; i < blob_bottom_label_->count(); ++i) {
     blob_bottom_label_->mutable_cpu_data()[i] = caffe_rng_rand() % 5;
   }
   blob_bottom_vec_.push_back(blob_bottom_label_);
   filler_param.set_min(0.1);
   filler_param.set_max(2.0);
   UniformFiller<Dtype> infogain_filler(filler_param);
   infogain_filler.Fill(this->blob_bottom_infogain_);
   blob_bottom_vec_.push_back(blob_bottom_infogain_);
   blob_top_vec_.push_back(blob_top_loss_);
 }