Skip to content
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

matlab warning #5346

Closed
sebastian-0x0000ff opened this issue Mar 2, 2017 · 5 comments
Closed

matlab warning #5346

sebastian-0x0000ff opened this issue Mar 2, 2017 · 5 comments
Labels

Comments

@sebastian-0x0000ff
Copy link

make all ok
make test ok
make matcaffe ok
make mattest 7 passed
but when I ran "net = caffe.Net(model, weights, 'test');" in matlab,I got this
Warning: The following error was caught while executing 'caffe.Net' class destructor:
Error using caffe_
Usage: caffe_('delete_solver', hNet)

Error in caffe.Net/delete (line 72)
caffe_('delete_net', self.hNet_self);

Error in caffe.Net (line 31)
self = caffe.get_net(varargin{:});

In caffe.Net (line 31)

system configuration
Operating system:Ubuntu16.10
Compiler:gcc 5.4
CUDA version (if applicable):8.0
CUDNN version (if applicable):5.1
BLAS:openblas
Python or MATLAB version (for pycaffe and matcaffe respectively):matlab2016b

@sebastian-0x0000ff
Copy link
Author

is that ok for ignoring?

@yang-fei
Copy link

I have the same problem, have you solved it?
my system:
ubuntu 14.04
gcc 4.8.4
CUDA: 8.0
CUDNN 5.1
BLAS: openblas
matlab2016b

@alireza1370
Copy link

I have the same problem!!! have you solved it?
my system:
ubuntu 14.04
gcc 4.9
matlab2016b

@ShaggO
Copy link

ShaggO commented May 4, 2017

The problem seems to be caused by the way object initialization is handled in Matlab.
Upon creation of a Net object, the output object (self) is actually created before any code is executed.
The code in Net.m, line 31:

self = caffe.get_net(varargin{:});

replaces the output object and therefore implicitly destroys the original object causing the destructor to be called on an object with an empty hNet_self "pointer".
This is fixable by adding a clause in the destructor checking if self.hNet_sel is empty or not.
I've create the PR #5588 fixing this issue

@alireza1370
Copy link

alireza1370 commented May 4, 2017 via email

meixiaofeng added a commit to meixiaofeng/caffe that referenced this issue May 24, 2017
I run the matlab classification_demo on windows, and I get the following error:

Warning: The following error was caught while executing 'caffe.Net' class destructor:
Error using caffe_
Could not convert handle to pointer due to invalid init_key. The object might have been cleared.

Error in caffe.Net/delete (line 72)
          caffe_('delete_net', self.hNet_self);

Just like @ShaggO put it," When constructing a network, the internal object initialization of Matlab actually creates a new network and replaces the already instantiated object, causing an empty network to be deleted".But the method and change used in BVLC#5346 and PR BVLC#5588 does not work for me.Since the solver object may have already been deleted but we still reference it like this, 'self.hSolver_self '. We must check if the sovler object is still valid before deleting it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants