提交 38d0063c 编写于 作者: V Vincent Rabaud

Do not use deprecated ReleaseCleared in protobuf library.

This is to make code work with protobuf arenas for memory
management (ReleaseCleared is incompatible).
The cleaning of the memory is also simpler.
上级 df834597
......@@ -306,16 +306,13 @@ public:
caffe::LayerParameter* binLayer = netBinary.mutable_layer(li);
const int numBlobs = binLayer->blobs_size();
std::vector<caffe::BlobProto*> blobs(numBlobs);
binLayer->mutable_blobs()->ExtractSubrange(0, numBlobs, blobs.data());
layerParams.blobs.resize(numBlobs);
for (int bi = 0; bi < numBlobs; bi++)
{
blobFromProto(binLayer->blobs(bi), layerParams.blobs[bi]);
}
binLayer->clear_blobs();
CV_Assert(numBlobs == binLayer->blobs().ClearedCount());
for (int bi = 0; bi < numBlobs; bi++)
{
delete binLayer->mutable_blobs()->ReleaseCleared();
blobFromProto(*blobs[bi], layerParams.blobs[bi]);
delete blobs[bi];
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册