NVIDIA / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
672 stars 263 forks source link

Nvidia-torch-caffe-binding #559

Closed PapaBeye closed 5 years ago

PapaBeye commented 5 years ago

Hello, everyone I was wondering if some could help me with this error I am getting while binding this version of caffe to torch. I am using https://github.com/lymhust/caffe_torch_binding and my error is with the caffe.cpp file. I have tried to correct the error but i need some help. Here is the error massage.

papa@beye:~/caffe_torch_binding$ CAFFE_DIR=$nCAFFE_ROOT/ luarocks make cmake -E make_directory build; cd build; cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/home/papa/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/home/papa/torch/install/lib/luarocks/rocks/caffe/1.0-0"; make

-- Found Torch7 in /home/papa/torch/install CAFFE_DIR: /home/papa/nvcaffe/ -- Configuring done -- Generating done -- Build files have been written to: /home/papa/caffe_torch_binding/build [ 50%] Building CXX object CMakeFiles/tcaffe.dir/caffe.cpp.o /home/papa/caffe_torch_binding/caffe.cpp: In function ‘void init(void, const char, const char, const char)’: /home/papa/caffe_torch_binding/caffe.cpp:52:3: error: ‘caffe::Net’ is not a template Net net_ = new Net(string(param_file), phase); ^ /home/papa/caffe_torchbinding/caffe.cpp:52:26: error: ‘caffe::Net’ is not a template Net* net = new Net(string(param_file), phase); ^ /home/papa/caffe_torch_binding/caffe.cpp: In function ‘void do_forward(void*, THFloatTensor, THFloatTensor)’: /home/papa/caffe_torch_binding/caffe.cpp:60:3: error: ‘caffe::Net’ is not a template Net net_ = (Net)handle[1]; ^ /home/papa/caffe_torch_binding/caffe.cpp:60:23: error: ‘caffe::Net’ is not a template Net net_ = (Net)handle[1]; ^ /home/papa/caffe_torch_binding/caffe.cpp:61:16: error: ‘caffe::Blob’ is not a template const vector<Blob>& inputblobs = net->input_blobs(); ^ /home/papa/caffe_torch_binding/caffe.cpp:69:44: error: no matching function for call to ‘caffe::Blob::mutable_cpu_data()’ input_blobs[i]->mutable_cpu_data()); ^ /home/papa/caffe_torch_binding/caffe.cpp:69:44: note: candidate is: In file included from /home/papa/nvcaffe/include/caffe/caffe.hpp:7:0, from /home/papa/caffe_torch_binding/caffe.cpp:5: /home/papa/nvcaffe/include/caffe/blob.hpp:338:10: note: template Dtype caffe::Blob::mutable_cpu_data() Dtype mutable_cpu_data() { // Keeping PyCaffe intact ^ /home/papa/nvcaffe/include/caffe/blob.hpp:338:10: note: template argument deduction/substitution failed: /home/papa/caffe_torch_binding/caffe.cpp:69:44: note: couldn't deduce template parameter ‘Dtype’ input_blobs[i]->mutable_cpu_data()); ^ /home/papa/caffe_torch_binding/caffe.cpp:73:44: error: no matching function for call to ‘caffe::Blob::mutable_gpu_data()’ input_blobs[i]->mutable_gpu_data()); ^ /home/papa/caffe_torch_binding/caffe.cpp:73:44: note: candidate is: In file included from /home/papa/nvcaffe/include/caffe/caffe.hpp:7:0, from /home/papa/caffe_torch_binding/caffe.cpp:5: /home/papa/nvcaffe/include/caffe/blob.hpp:510:10: note: template Dtype caffe::Blob::mutable_gpu_data() Dtype mutable_gpu_data() { // Keeping PyCaffe intact ^ /home/papa/nvcaffe/include/caffe/blob.hpp:510:10: note: template argument deduction/substitution failed: /home/papa/caffe_torch_binding/caffe.cpp:73:44: note: couldn't deduce template parameter ‘Dtype’ input_blobs[i]->mutable_gpu_data()); ^ /home/papa/caffe_torch_binding/caffe.cpp:79:16: error: ‘caffe::Blob’ is not a template const vector<Blob>& outputblobs = net->ForwardPrefilled(); ^ /home/papa/caffe_torch_binding/caffe.cpp:79:52: error: ‘class caffe::Net’ has no member named ‘ForwardPrefilled’ const vector<Blob>& outputblobs = net->ForwardPrefilled(); ^ /home/papa/caffe_torch_binding/caffe.cpp:87:70: error: no matching function for call to ‘caffe::Blob::cpu_data()’ caffe_copy(output_blobs[i]->count(), output_blobs[i]->cpu_data(), ^ /home/papa/caffe_torch_binding/caffe.cpp:87:70: note: candidate is: In file included from /home/papa/nvcaffe/include/caffe/caffe.hpp:7:0, from /home/papa/caffe_torch_binding/caffe.cpp:5: /home/papa/nvcaffe/include/caffe/blob.hpp:320:16: note: template const Dtype caffe::Blob::cpu_data() const const Dtype cpu_data() const { ^ /home/papa/nvcaffe/include/caffe/blob.hpp:320:16: note: template argument deduction/substitution failed: /home/papa/caffe_torch_binding/caffe.cpp:87:70: note: couldn't deduce template parameter ‘Dtype’ caffe_copy(output_blobs[i]->count(), output_blobs[i]->cpu_data(), ^ /home/papa/caffe_torch_binding/caffe.cpp:91:70: error: no matching function for call to ‘caffe::Blob::gpu_data()’ caffe_copy(output_blobs[i]->count(), output_blobs[i]->gpu_data(), ^ /home/papa/caffe_torch_binding/caffe.cpp:91:70: note: candidate is: In file included from /home/papa/nvcaffe/include/caffe/caffe.hpp:7:0, from /home/papa/caffe_torch_binding/caffe.cpp:5: /home/papa/nvcaffe/include/caffe/blob.hpp:492:16: note: template const Dtype caffe::Blob::gpu_data() const const Dtype gpu_data() const { ^ /home/papa/nvcaffe/include/caffe/blob.hpp:492:16: note: template argument deduction/substitution failed: /home/papa/caffe_torch_binding/caffe.cpp:91:70: note: couldn't deduce template parameter ‘Dtype’ caffe_copy(output_blobs[i]->count(), output_blobs[i]->gpu_data(), ^ /home/papa/caffe_torch_binding/caffe.cpp: In function ‘void do_backward(void, THFloatTensor, THFloatTensor)’: /home/papa/caffe_torchbinding/caffe.cpp:102:3: error: ‘caffe::Net’ is not a template Net* net = (Net)handle[1]; ^ /home/papa/caffe_torch_binding/caffe.cpp:102:23: error: ‘caffe::Net’ is not a template Net net_ = (Net)handle[1]; ^ /home/papa/caffe_torch_binding/caffe.cpp:103:16: error: ‘caffe::Blob’ is not a template const vector<Blob>& outputblobs = net->output_blobs(); ^ /home/papa/caffe_torch_binding/caffe.cpp:104:16: error: ‘caffe::Blob’ is not a template const vector<Blob>& inputblobs = net->input_blobs(); ^ /home/papa/caffe_torch_binding/caffe.cpp:111:45: error: no matching function for call to ‘caffe::Blob::mutable_cpu_diff()’ output_blobs[i]->mutable_cpu_diff()); ^ /home/papa/caffe_torch_binding/caffe.cpp:111:45: note: candidate is: In file included from /home/papa/nvcaffe/include/caffe/caffe.hpp:7:0, from /home/papa/caffe_torch_binding/caffe.cpp:5: /home/papa/nvcaffe/include/caffe/blob.hpp:349:10: note: template Dtype caffe::Blob::mutable_cpu_diff() Dtype mutable_cpu_diff() { ^ /home/papa/nvcaffe/include/caffe/blob.hpp:349:10: note: template argument deduction/substitution failed: /home/papa/caffe_torch_binding/caffe.cpp:111:45: note: couldn't deduce template parameter ‘Dtype’ output_blobs[i]->mutable_cpu_diff()); ^ /home/papa/caffe_torch_binding/caffe.cpp:115:45: error: no matching function for call to ‘caffe::Blob::mutable_gpu_diff()’ output_blobs[i]->mutable_gpu_diff()); ^ /home/papa/caffe_torch_binding/caffe.cpp:115:45: note: candidate is: In file included from /home/papa/nvcaffe/include/caffe/caffe.hpp:7:0, from /home/papa/caffe_torch_binding/caffe.cpp:5: /home/papa/nvcaffe/include/caffe/blob.hpp:521:10: note: template Dtype caffe::Blob::mutable_gpu_diff() Dtype mutable_gpu_diff() { ^ /home/papa/nvcaffe/include/caffe/blob.hpp:521:10: note: template argument deduction/substitution failed: /home/papa/caffe_torch_binding/caffe.cpp:115:45: note: couldn't deduce template parameter ‘Dtype’ output_blobs[i]->mutable_gpu_diff()); ^ /home/papa/caffe_torch_binding/caffe.cpp:131:68: error: no matching function for call to ‘caffe::Blob::cpu_diff()’ caffe_copy(input_blobs[i]->count(), input_blobs[i]->cpu_diff(), data_ptr); ^ /home/papa/caffe_torch_binding/caffe.cpp:131:68: note: candidate is: In file included from /home/papa/nvcaffe/include/caffe/caffe.hpp:7:0, from /home/papa/caffe_torch_binding/caffe.cpp:5: /home/papa/nvcaffe/include/caffe/blob.hpp:326:16: note: template const Dtype caffe::Blob::cpu_diff() const const Dtype cpu_diff() const { ^ /home/papa/nvcaffe/include/caffe/blob.hpp:326:16: note: template argument deduction/substitution failed: /home/papa/caffe_torch_binding/caffe.cpp:131:68: note: couldn't deduce template parameter ‘Dtype’ caffe_copy(input_blobs[i]->count(), input_blobs[i]->cpu_diff(), data_ptr); ^ /home/papa/caffe_torch_binding/caffe.cpp:134:68: error: no matching function for call to ‘caffe::Blob::gpu_diff()’ caffe_copy(input_blobs[i]->count(), input_blobs[i]->gpu_diff(), data_ptr); ^ /home/papa/caffe_torch_binding/caffe.cpp:134:68: note: candidate is: In file included from /home/papa/nvcaffe/include/caffe/caffe.hpp:7:0, from /home/papa/caffe_torch_binding/caffe.cpp:5: /home/papa/nvcaffe/include/caffe/blob.hpp:498:16: note: template const Dtype caffe::Blob::gpu_diff() const const Dtype gpu_diff() const { ^ /home/papa/nvcaffe/include/caffe/blob.hpp:498:16: note: template argument deduction/substitution failed: /home/papa/caffe_torch_binding/caffe.cpp:134:68: note: couldn't deduce template parameter ‘Dtype’ caffe_copy(input_blobs[i]->count(), input_blobs[i]->gpu_diff(), data_ptr); ^ /home/papa/caffe_torch_binding/caffe.cpp: In function ‘void read_mean(const char, THFloatTensor)’: /home/papa/caffe_torch_binding/caffe.cpp:145:5: error: ‘caffe::Blob’ is not a template Blob data_mean; ^ /home/papa/caffe_torch_binding/caffe.cpp:145:17: error: no matching function for call to ‘caffe::Blob::Blob()’ Blob data_mean; ^ /home/papa/caffe_torch_binding/caffe.cpp:145:17: note: candidates are: In file included from /home/papa/nvcaffe/include/caffe/caffe.hpp:7:0, from /home/papa/caffe_torch_binding/caffe.cpp:5: /home/papa/nvcaffe/include/caffe/blob.hpp:54:12: note: caffe::Blob::Blob(caffe::Type) explicit Blob(Type dtype) ^ /home/papa/nvcaffe/include/caffe/blob.hpp:54:12: note: candidate expects 1 argument, 0 provided /home/papa/nvcaffe/include/caffe/blob.hpp:48:3: note: caffe::Blob::Blob(caffe::Type, caffe::Type) Blob(Type data_type, Type diff_type) ^ /home/papa/nvcaffe/include/caffe/blob.hpp:48:3: note: candidate expects 2 arguments, 0 provided /home/papa/caffe_torch_binding/caffe.cpp:153:54: error: no matching function for call to ‘caffe::Blob::cpu_data()’ caffe_copy(data_mean.count(), data_mean.cpu_data(), data_ptr); ^ /home/papa/caffe_torch_binding/caffe.cpp:153:54: note: candidate is: In file included from /home/papa/nvcaffe/include/caffe/caffe.hpp:7:0, from /home/papa/caffe_torch_binding/caffe.cpp:5: /home/papa/nvcaffe/include/caffe/blob.hpp:320:16: note: template const Dtype caffe::Blob::cpu_data() const const Dtype* cpu_data() const { ^ /home/papa/nvcaffe/include/caffe/blob.hpp:320:16: note: template argument deduction/substitution failed: /home/papa/caffe_torch_binding/caffe.cpp:153:54: note: couldn't deduce template parameter ‘Dtype’ caffe_copy(data_mean.count(), data_mean.cpu_data(), data_ptr); ^ /home/papa/caffe_torch_binding/caffe.cpp: In function ‘unsigned int get_blob_index(void, const char)’: /home/papa/caffe_torch_binding/caffe.cpp:158:2: error: ‘caffe::Net’ is not a template Net net_ = (Net)handle[1]; ^ /home/papa/caffe_torch_binding/caffe.cpp:158:22: error: ‘caffe::Net’ is not a template Net net_ = (Net*)handle[1]; ^ /home/papa/caffe_torch_binding/caffe.cpp: In function ‘void get_blob_data(void*, unsigned int, THFloatTensor)’: /home/papa/caffe_torchbinding/caffe.cpp:172:2: error: ‘caffe::Net’ is not a template Net* net = (Net)handle[1]; ^ /home/papa/caffe_torch_binding/caffe.cpp:172:22: error: ‘caffe::Net’ is not a template Net net_ = (Net)handle[1]; ^ /home/papa/caffe_torch_binding/caffe.cpp:173:20: error: ‘caffe::Blob’ is not a template boost::shared_ptr<Blob > outputblobs = net->blobs()[blob_id]; ^ /home/papa/caffe_torch_binding/caffe.cpp:179:61: error: no matching function for call to ‘caffe::Blob::cpu_data()’ caffe_copy(output_blobs->count(), output_blobs->cpu_data(), data_ptr); ^ /home/papa/caffe_torch_binding/caffe.cpp:179:61: note: candidate is: In file included from /home/papa/nvcaffe/include/caffe/caffe.hpp:7:0, from /home/papa/caffe_torch_binding/caffe.cpp:5: /home/papa/nvcaffe/include/caffe/blob.hpp:320:16: note: template const Dtype caffe::Blob::cpu_data() const const Dtype cpu_data() const { ^ /home/papa/nvcaffe/include/caffe/blob.hpp:320:16: note: template argument deduction/substitution failed: /home/papa/caffe_torch_binding/caffe.cpp:179:61: note: couldn't deduce template parameter ‘Dtype’ caffe_copy(output_blobs->count(), output_blobs->cpu_data(), data_ptr); ^ /home/papa/caffe_torch_binding/caffe.cpp:182:61: error: no matching function for call to ‘caffe::Blob::gpu_data()’ caffe_copy(output_blobs->count(), output_blobs->gpu_data(), data_ptr); ^ /home/papa/caffe_torch_binding/caffe.cpp:182:61: note: candidate is: In file included from /home/papa/nvcaffe/include/caffe/caffe.hpp:7:0, from /home/papa/caffe_torch_binding/caffe.cpp:5: /home/papa/nvcaffe/include/caffe/blob.hpp:492:16: note: template const Dtype caffe::Blob::gpu_data() const const Dtype* gpu_data() const { ^ /home/papa/nvcaffe/include/caffe/blob.hpp:492:16: note: template argument deduction/substitution failed: /home/papa/caffe_torch_binding/caffe.cpp:182:61: note: couldn't deduce template parameter ‘Dtype’ caffe_copy(output_blobs->count(), output_blobs->gpu_data(), data_ptr); ^ /home/papa/caffe_torch_binding/caffe.cpp: In function ‘void reshape(void, int, int, int, int)’: /home/papa/caffe_torchbinding/caffe.cpp:190:2: error: ‘caffe::Net’ is not a template Net* net = (Net)handle[1]; ^ /home/papa/caffe_torch_binding/caffe.cpp:190:22: error: ‘caffe::Net’ is not a template Net net_ = (Net)handle[1]; ^ /home/papa/caffe_torch_binding/caffe.cpp:191:2: error: ‘caffe::Blob’ is not a template Blob inputlayer = net->input_blobs()[0]; ^ /home/papa/caffe_torch_binding/caffe.cpp: In function ‘void save_model(void, char)’: /home/papa/caffe_torch_binding/caffe.cpp:198:2: error: ‘caffe::Net’ is not a template Net net_ = (Net)handle[1]; ^ /home/papa/caffe_torch_binding/caffe.cpp:198:22: error: ‘caffe::Net’ is not a template Net net_ = (Net*)handle[1]; ^ /home/papa/caffe_torch_binding/caffe.cpp: In function ‘void reset(void*)’: /home/papa/caffe_torch_binding/caffe.cpp:206:3: error: ‘caffe::Net’ is not a template Net net_ = (Net)handle[1]; ^ /home/papa/caffe_torch_binding/caffe.cpp:206:23: error: ‘caffe::Net’ is not a template Net net_ = (Net)handle[1]; ^ make[2]: [CMakeFiles/tcaffe.dir/caffe.cpp.o] Error 1 make[1]: [CMakeFiles/tcaffe.dir/all] Error 2 make: [all] Error 2

Error: Build error: Failed building.

drnikolaev commented 5 years ago

Looks like that binding bytes the original BVLC Caffe.

PapaBeye commented 5 years ago

Thank you so much! I did use the original BVLC Caffe 1.0 at first but switched to nvcaffe because I was getting this error papa@beye:~/caffe_torch_binding$ CAFFE_DIR=$CAFFE_ROOT/ luarocks make cmake -E make_directory build; cd build; cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/home/papa/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/home/papa/torch/install/lib/luarocks/rocks/caffe/1.0-0"; make

-- Found Torch7 in /home/papa/torch/install CAFFE_DIR: /home/papa/caffe-1.0/ -- Configuring done -- Generating done -- Build files have been written to: /home/papa/caffe_torch_binding/build [ 50%] Building CXX object CMakeFiles/tcaffe.dir/caffe.cpp.o /home/papa/caffe_torch_binding/caffe.cpp:6:37: fatal error: caffe/util/gpu_memory.hpp: No such file or directory compilation terminated. CMakeFiles/tcaffe.dir/build.make:62: recipe for target 'CMakeFiles/tcaffe.dir/caffe.cpp.o' failed make[2]: [CMakeFiles/tcaffe.dir/caffe.cpp.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/tcaffe.dir/all' failed make[1]: [CMakeFiles/tcaffe.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *** [all] Error 2

Error: Build error: Failed building.

drnikolaev commented 5 years ago

@PapaBeye Seems like you need BVLC Caffe