You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is my construction of Classifier:
Classifier::Classifier(const std::string& model_file,
const std::string& trained_file)
{
#ifdef CPU_ONLY
Caffe::set_mode(Caffe::CPU);
#else
Caffe::set_mode(Caffe::GPU);
#endif
/* Load the network. */
net_.reset(new Net<float>(model_file, TEST));
net_->CopyTrainedLayersFrom(trained_file);
CHECK_EQ(net_->num_inputs(), 1) << "Network should have exactly one input.";
CHECK_EQ(net_->num_outputs(), 1) << "Network should have exactly one output.";
Blob<float>* input_layer = net_->input_blobs()[0];
num_channels_ = input_layer->channels();
CHECK(num_channels_ == 3 || num_channels_ == 1)
<< "Input layer should have 1 or 3 channels.";
input_geometry_ = cv::Size(input_layer->width(), input_layer->height());
}
and,this is my test code:
Classifier* cnn_1 = new Classifier(lenet_model_file, lenet_trained_file);
delete cnn_1;
the problem is after deleting cnn_1, the memory of GPU is not released.
Please tell me how to release the memory of GPU caused by loading the model.
The text was updated successfully, but these errors were encountered:
mmchen88
changed the title
after delete a Net instance, GPU memory is not released
after deleting a Net instance, GPU memory is not released
Apr 18, 2020
mmchen88
changed the title
after deleting a Net instance, GPU memory is not released
after deleting a Net instance, the GPU memory is not released
Apr 18, 2020
This is my construction of Classifier:
Classifier::Classifier(const std::string& model_file,
const std::string& trained_file)
{
#ifdef CPU_ONLY
Caffe::set_mode(Caffe::CPU);
#else
Caffe::set_mode(Caffe::GPU);
#endif
}
and,this is my test code:
Classifier* cnn_1 = new Classifier(lenet_model_file, lenet_trained_file);
delete cnn_1;
the problem is after deleting cnn_1, the memory of GPU is not released.
Please tell me how to release the memory of GPU caused by loading the model.
The text was updated successfully, but these errors were encountered: