diff options
author | Sebastian Messmer <messmer@fb.com> | 2018-10-17 11:48:56 -0700 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2018-10-17 11:50:34 -0700 |
commit | 6cbf1992bd6dfbf42a33260bee2c93f6eac51b3a (patch) | |
tree | f0f632db2d5fcad45ce8a6802986729ae62c48d9 /caffe2/sgd | |
parent | 25db86cca525f876573ed965d94136dd5d9eb9d4 (diff) | |
download | pytorch-6cbf1992bd6dfbf42a33260bee2c93f6eac51b3a.tar.gz pytorch-6cbf1992bd6dfbf42a33260bee2c93f6eac51b3a.tar.bz2 pytorch-6cbf1992bd6dfbf42a33260bee2c93f6eac51b3a.zip |
Serialization takes pointers instead of Blob (#11925)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/11925
This is step 1 in the refactoring to remove Blob::ShareExternal(), i.e. Blob would then always own its contents.
ShareExternal() is for example used to pass non-owning blobs to serialization. This diff prepares removing that.
Reviewed By: ezyang
Differential Revision: D9884177
fbshipit-source-id: d01df9a613a4fc62e5679fe45bfc47e2c899b818
Diffstat (limited to 'caffe2/sgd')
-rw-r--r-- | caffe2/sgd/iter_op.cc | 5 | ||||
-rw-r--r-- | caffe2/sgd/iter_op.h | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/caffe2/sgd/iter_op.cc b/caffe2/sgd/iter_op.cc index ac964018b9..222b20fb6f 100644 --- a/caffe2/sgd/iter_op.cc +++ b/caffe2/sgd/iter_op.cc @@ -8,10 +8,11 @@ namespace caffe2 { void MutexSerializer::Serialize( - const Blob& blob, + const void* pointer, + TypeMeta typeMeta, const string& name, BlobSerializerBase::SerializationAcceptor acceptor) { - CAFFE_ENFORCE(blob.IsType<std::unique_ptr<std::mutex>>()); + CAFFE_ENFORCE(typeMeta.Match<std::unique_ptr<std::mutex>>()); BlobProto blob_proto; blob_proto.set_name(name); blob_proto.set_type("std::unique_ptr<std::mutex>"); diff --git a/caffe2/sgd/iter_op.h b/caffe2/sgd/iter_op.h index 22ec8d252c..86a4c676bc 100644 --- a/caffe2/sgd/iter_op.h +++ b/caffe2/sgd/iter_op.h @@ -88,7 +88,8 @@ class MutexSerializer : public BlobSerializerBase { * fatal error. */ void Serialize( - const Blob& blob, + const void* pointer, + TypeMeta typeMeta, const string& name, BlobSerializerBase::SerializationAcceptor acceptor) override; }; |