-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tensor is a deleted function - Print method #75
Comments
As the comment mentioned: "Delete the copy constructor and use Clone explicitly" |
Hi @rednoah91 , thanks for your reply. I tried what you mentioned, however, errors are still there. Errors are caused by line 11 in the print method (auto tensor = blob->Get();). Do you know how to fix it? |
Just add the |
Hi @zacario-li @ferasboulala , for some cases your suggestion fixed the error, however, I also get the following error:
The relevant code for the error:
I added
Any ideas to fix this error? |
Hi all,
I am getting 2 errors during building solution. I checked the header file tensor.h and I saw the following: /**
*/
Tensor(const Tensor& src) = delete;
The mentioned 2 errors:
Severity Code Description Project File Line Suppression State
Error (active) function "caffe2::Tensor::Tensor(const caffe2::Tensor &src) [with Context=caffe2::CPUContext]" (declared at line 706 of "d:\Yeverino\git_projects\pytorch\caffe2\core\tensor.h") cannot be referenced -- it is a deleted function ConsoleApplication1 d:\Yeverino\visual studio projects\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.cpp 11
Severity Code Description Project File Line Suppression State
Error C2280 'caffe2::Tensorcaffe2::CPUContext::Tensor(const caffe2::Tensorcaffe2::CPUContext &)': attempting to reference a deleted function ConsoleApplication1 d:\yeverino\visual studio projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp 11
How should I modify the print method included in the tutorials in order to fix the errors?
void print(const Blob* blob, const std::string& name) {
auto tensor = blob->Get();
const auto& data = tensor.data();
std::cout << name << "(" << tensor.dims()
<< "): " << std::vector(data, data + tensor.size())
<< std::endl;
}
The text was updated successfully, but these errors were encountered: