fix types of (Layer)SetUp, Reshape, Forward, and Backward calls
[platform/upstream/caffeonacl.git] / src / caffe / layers / hdf5_data_layer.cu
index 9c5bb5a..f671ea1 100644 (file)
@@ -1,4 +1,3 @@
-// Copyright 2014 BVLC and contributors.
 /*
 TODO:
 - only load parts of the file, in accordance with a prototxt param "max_mem"
@@ -15,16 +14,14 @@ TODO:
 #include "caffe/util/io.hpp"
 #include "caffe/vision_layers.hpp"
 
-using std::string;
-
 namespace caffe {
 
 template <typename Dtype>
-Dtype HDF5DataLayer<Dtype>::Forward_gpu(const vector<Blob<Dtype>*>& bottom,
-      vector<Blob<Dtype>*>* top) {
+void HDF5DataLayer<Dtype>::Forward_gpu(const vector<Blob<Dtype>*>& bottom,
+      const vector<Blob<Dtype>*>& top) {
   const int batch_size = this->layer_param_.hdf5_data_param().batch_size();
-  const int data_count = (*top)[0]->count() / (*top)[0]->num();
-  const int label_data_count = (*top)[1]->count() / (*top)[1]->num();
+  const int data_count = top[0]->count() / top[0]->num();
+  const int label_data_count = top[1]->count() / top[1]->num();
 
   for (int i = 0; i < batch_size; ++i, ++current_row_) {
     if (current_row_ == data_blob_.num()) {
@@ -40,23 +37,13 @@ Dtype HDF5DataLayer<Dtype>::Forward_gpu(const vector<Blob<Dtype>*>& bottom,
       }
       current_row_ = 0;
     }
-    CUDA_CHECK(cudaMemcpy(
-            &(*top)[0]->mutable_gpu_data()[i * data_count],
-            &data_blob_.cpu_data()[current_row_ * data_count],
-            sizeof(Dtype) * data_count,
-            cudaMemcpyHostToDevice));
-    CUDA_CHECK(cudaMemcpy(
-            &(*top)[1]->mutable_gpu_data()[i * label_data_count],
-            &label_blob_.cpu_data()[current_row_ * label_data_count],
-            sizeof(Dtype) * label_data_count,
-            cudaMemcpyHostToDevice));
+    caffe_copy(data_count,
+        &data_blob_.cpu_data()[current_row_ * data_count],
+        &top[0]->mutable_gpu_data()[i * data_count]);
+    caffe_copy(label_data_count,
+        &label_blob_.cpu_data()[current_row_ * label_data_count],
+        &top[1]->mutable_gpu_data()[i * label_data_count]);
   }
-  return Dtype(0.);
-}
-
-template <typename Dtype>
-void HDF5DataLayer<Dtype>::Backward_gpu(const vector<Blob<Dtype>*>& top,
-      const bool propagate_down, vector<Blob<Dtype>*>* bottom) {
 }
 
 INSTANTIATE_CLASS(HDF5DataLayer);