caffe2_cpp_tutorial icon indicating copy to clipboard operation
caffe2_cpp_tutorial copied to clipboard

Compile error

Open syinari0123 opened this issue 7 years ago • 2 comments

Thank you for this caffe2 cpp tutorial. I encountered following error when compiling this code (make).

/home/user/Desktop/caffe2_cpp_tutorial/src/caffe2/util/blob.cc: In member function ‘caffe2::TensorCPU caffe2::BlobUtil::Get()’:
/home/user/Desktop/caffe2_cpp_tutorial/src/caffe2/util/blob.cc:16:31: error: use of deleted function ‘caffe2::Tensor<Context>::Tensor(const caffe2::Tensor<Context>&) [with Context = caffe2::CPUContext]’
   return blob_.Get<TensorCPU>();
                               ^
In file included from /home/user/Desktop/caffe2_cpp_tutorial/include/caffe2/util/blob.h:5:0,
                 from /home/user/Desktop/caffe2_cpp_tutorial/src/caffe2/util/blob.cc:1:
/usr/local/include/caffe2/core/tensor.h:706:3: note: declared here
   Tensor(const Tensor<Context>& src) = delete;

My environment is

  • Ubuntu : 16.04
  • g++ : 5.4
  • Caffe2 : newest version from https://caffe2.ai/docs/getting-started.html?platform=ubuntu&configuration=compile

Do you have any idea to solve this problem?

syinari0123 avatar Jun 30 '18 01:06 syinari0123

Same problem here, any hints?

augustofg avatar Jul 16 '18 21:07 augustofg

use GetMutable or blob_.Get<TensorCPU>().Clone()

rednoah91 avatar Jul 20 '18 02:07 rednoah91