diff --git a/src/Makefile b/src/Makefile index b8c9dcc1..ec678100 100644 --- a/src/Makefile +++ b/src/Makefile @@ -8,7 +8,7 @@ PROJECT := caffeine NAME := lib$(PROJECT).so 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 PROTO_SRCS := $(wildcard caffeine/proto/*.proto) PROTO_GEN_HEADER := ${PROTO_SRCS:.proto=.pb.h} diff --git a/src/caffeine/_blob.cpp b/src/caffeine/blob.cpp similarity index 67% rename from src/caffeine/_blob.cpp rename to src/caffeine/blob.cpp index 8eb95ab5..580f5eb2 100644 --- a/src/caffeine/_blob.cpp +++ b/src/caffeine/blob.cpp @@ -18,50 +18,50 @@ void Blob::Reshape(const int num, const int channels, const int height, template const Dtype* Blob::cpu_data() { - check_data(); - return data_->cpu_data(); + CHECK(data_); + return (const Dtype*)data_->cpu_data(); } template const Dtype* Blob::gpu_data() { - check_data(); - return data_->gpu_data(); + CHECK(data_); + return (const Dtype*)data_->gpu_data(); } template const Dtype* Blob::cpu_diff() { - check_diff(); - return diff_->cpu_data(); + CHECK(diff_); + return (const Dtype*)diff_->cpu_data(); } template const Dtype* Blob::gpu_diff() { - check_diff(); - return diff_->gpu_data(); + CHECK(diff_); + return (const Dtype*)diff_->gpu_data(); } template Dtype* Blob::mutable_cpu_data() { - check_data(); - return data_->mutable_cpu_data(); + CHECK(data_); + return (Dtype*)data_->mutable_cpu_data(); } template Dtype* Blob::mutable_gpu_data() { - check_data(); - return data_->mutable_gpu_data(); + CHECK(data_); + return (Dtype*)data_->mutable_gpu_data(); } template Dtype* Blob::mutable_cpu_diff() { - check_diff(); - return diff_->mutable_cpu_data(); + CHECK(diff_); + return (Dtype*)diff_->mutable_cpu_data(); } template Dtype* Blob::mutable_gpu_diff() { - check_diff(); - return diff_->mutable_gpu_data(); + CHECK(diff_); + return (Dtype*)diff_->mutable_gpu_data(); } template @@ -69,5 +69,8 @@ void Blob::update() { } +template class Blob; +template class Blob; + } // namespace caffeine diff --git a/src/caffeine/blob.hpp b/src/caffeine/blob.hpp index a2e31315..5f0f3eef 100644 --- a/src/caffeine/blob.hpp +++ b/src/caffeine/blob.hpp @@ -37,8 +37,6 @@ class Blob { Dtype* mutable_gpu_diff(); void update(); private: - void check_data(); - void check_diff(); shared_ptr data_; shared_ptr diff_; int num_; @@ -50,6 +48,4 @@ class Blob { } // namespace caffeine -#include "caffeine/_blob.cpp" - #endif // CAFFEINE_BLOB_HPP_