man I am changing ideas so fast.

This commit is contained in:
Yangqing Jia 2013-09-13 12:59:55 -07:00
Родитель 0522453820
Коммит abe7272286
3 изменённых файлов: 20 добавлений и 21 удалений

Просмотреть файл

@ -8,7 +8,7 @@
PROJECT := caffeine PROJECT := caffeine
NAME := lib$(PROJECT).so NAME := lib$(PROJECT).so
TEST_NAME := test_$(PROJECT) TEST_NAME := test_$(PROJECT)
CXX_SRCS := $(shell find caffeine ! -name "test_*.cpp" ! -name "_*.cpp" -name "*.cpp") CXX_SRCS := $(shell find caffeine ! -name "test_*.cpp" -name "*.cpp")
TEST_SRCS := $(shell find caffeine -name "test_*.cpp") gtest/gtest-all.cpp TEST_SRCS := $(shell find caffeine -name "test_*.cpp") gtest/gtest-all.cpp
PROTO_SRCS := $(wildcard caffeine/proto/*.proto) PROTO_SRCS := $(wildcard caffeine/proto/*.proto)
PROTO_GEN_HEADER := ${PROTO_SRCS:.proto=.pb.h} PROTO_GEN_HEADER := ${PROTO_SRCS:.proto=.pb.h}

Просмотреть файл

@ -18,50 +18,50 @@ void Blob<Dtype>::Reshape(const int num, const int channels, const int height,
template <typename Dtype> template <typename Dtype>
const Dtype* Blob<Dtype>::cpu_data() { const Dtype* Blob<Dtype>::cpu_data() {
check_data(); CHECK(data_);
return data_->cpu_data(); return (const Dtype*)data_->cpu_data();
} }
template <typename Dtype> template <typename Dtype>
const Dtype* Blob<Dtype>::gpu_data() { const Dtype* Blob<Dtype>::gpu_data() {
check_data(); CHECK(data_);
return data_->gpu_data(); return (const Dtype*)data_->gpu_data();
} }
template <typename Dtype> template <typename Dtype>
const Dtype* Blob<Dtype>::cpu_diff() { const Dtype* Blob<Dtype>::cpu_diff() {
check_diff(); CHECK(diff_);
return diff_->cpu_data(); return (const Dtype*)diff_->cpu_data();
} }
template <typename Dtype> template <typename Dtype>
const Dtype* Blob<Dtype>::gpu_diff() { const Dtype* Blob<Dtype>::gpu_diff() {
check_diff(); CHECK(diff_);
return diff_->gpu_data(); return (const Dtype*)diff_->gpu_data();
} }
template <typename Dtype> template <typename Dtype>
Dtype* Blob<Dtype>::mutable_cpu_data() { Dtype* Blob<Dtype>::mutable_cpu_data() {
check_data(); CHECK(data_);
return data_->mutable_cpu_data(); return (Dtype*)data_->mutable_cpu_data();
} }
template <typename Dtype> template <typename Dtype>
Dtype* Blob<Dtype>::mutable_gpu_data() { Dtype* Blob<Dtype>::mutable_gpu_data() {
check_data(); CHECK(data_);
return data_->mutable_gpu_data(); return (Dtype*)data_->mutable_gpu_data();
} }
template <typename Dtype> template <typename Dtype>
Dtype* Blob<Dtype>::mutable_cpu_diff() { Dtype* Blob<Dtype>::mutable_cpu_diff() {
check_diff(); CHECK(diff_);
return diff_->mutable_cpu_data(); return (Dtype*)diff_->mutable_cpu_data();
} }
template <typename Dtype> template <typename Dtype>
Dtype* Blob<Dtype>::mutable_gpu_diff() { Dtype* Blob<Dtype>::mutable_gpu_diff() {
check_diff(); CHECK(diff_);
return diff_->mutable_gpu_data(); return (Dtype*)diff_->mutable_gpu_data();
} }
template <typename Dtype> template <typename Dtype>
@ -69,5 +69,8 @@ void Blob<Dtype>::update() {
} }
template class Blob<float>;
template class Blob<double>;
} // namespace caffeine } // namespace caffeine

Просмотреть файл

@ -37,8 +37,6 @@ class Blob {
Dtype* mutable_gpu_diff(); Dtype* mutable_gpu_diff();
void update(); void update();
private: private:
void check_data();
void check_diff();
shared_ptr<SyncedMemory> data_; shared_ptr<SyncedMemory> data_;
shared_ptr<SyncedMemory> diff_; shared_ptr<SyncedMemory> diff_;
int num_; int num_;
@ -50,6 +48,4 @@ class Blob {
} // namespace caffeine } // namespace caffeine
#include "caffeine/_blob.cpp"
#endif // CAFFEINE_BLOB_HPP_ #endif // CAFFEINE_BLOB_HPP_