From 2b28b2090d9e47b47ee083a5e46467761cb8941c Mon Sep 17 00:00:00 2001 From: Kai Li Date: Sun, 23 Mar 2014 20:30:52 +0800 Subject: [PATCH] Rebase and change the HDF5OutputLayer::Forward/Backward signatures --- include/caffe/vision_layers.hpp | 8 ++++---- src/caffe/layers/hdf5_output_layer.cpp | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/include/caffe/vision_layers.hpp b/include/caffe/vision_layers.hpp index fb0c0dd6..74b27ccf 100644 --- a/include/caffe/vision_layers.hpp +++ b/include/caffe/vision_layers.hpp @@ -490,13 +490,13 @@ class HDF5OutputLayer : public Layer { inline std::string file_name() const { return file_name_; } protected: - virtual void Forward_cpu(const vector*>& bottom, + virtual Dtype Forward_cpu(const vector*>& bottom, vector*>* top); - virtual void Forward_gpu(const vector*>& bottom, + virtual Dtype Forward_gpu(const vector*>& bottom, vector*>* top); - virtual Dtype Backward_cpu(const vector*>& top, + virtual void Backward_cpu(const vector*>& top, const bool propagate_down, vector*>* bottom); - virtual Dtype Backward_gpu(const vector*>& top, + virtual void Backward_gpu(const vector*>& top, const bool propagate_down, vector*>* bottom); virtual void SaveBlobs(); diff --git a/src/caffe/layers/hdf5_output_layer.cpp b/src/caffe/layers/hdf5_output_layer.cpp index 3bf8dc2b..419c6c83 100644 --- a/src/caffe/layers/hdf5_output_layer.cpp +++ b/src/caffe/layers/hdf5_output_layer.cpp @@ -54,7 +54,7 @@ void HDF5OutputLayer::SetUp(const vector*>& bottom, } template -void HDF5OutputLayer::Forward_cpu(const vector*>& bottom, +Dtype HDF5OutputLayer::Forward_cpu(const vector*>& bottom, vector*>* top) { CHECK_GE(bottom.size(), 2); CHECK_EQ(bottom[0]->num(), bottom[1]->num()); @@ -74,10 +74,11 @@ void HDF5OutputLayer::Forward_cpu(const vector*>& bottom, sizeof(Dtype) * label_datum_dim); } SaveBlobs(); + return Dtype(0.); } template -void HDF5OutputLayer::Forward_gpu(const vector*>& bottom, +Dtype HDF5OutputLayer::Forward_gpu(const vector*>& bottom, vector*>* top) { CHECK_GE(bottom.size(), 2); CHECK_EQ(bottom[0]->num(), bottom[1]->num()); @@ -97,18 +98,19 @@ void HDF5OutputLayer::Forward_gpu(const vector*>& bottom, sizeof(Dtype) * label_datum_dim, cudaMemcpyDeviceToHost)); } SaveBlobs(); -} - -template -Dtype HDF5OutputLayer::Backward_cpu(const vector*>& top, - const bool propagate_down, vector*>* bottom) { return Dtype(0.); } template -Dtype HDF5OutputLayer::Backward_gpu(const vector*>& top, +void HDF5OutputLayer::Backward_cpu(const vector*>& top, const bool propagate_down, vector*>* bottom) { - return Dtype(0.); + return; +} + +template +void HDF5OutputLayer::Backward_gpu(const vector*>& top, + const bool propagate_down, vector*>* bottom) { + return; } INSTANTIATE_CLASS(HDF5OutputLayer);