Caffe2 - C++ API
A deep learning, cross platform ML framework
blob_serializer_base.h
1 
17 #pragma once
18 
19 #include <string>
20 #include <functional>
21 
22 namespace caffe2 {
23 
24 class Blob;
25 
26 constexpr int kDefaultChunkSize = -1;
27 constexpr int kNoChunking = 0;
28 
40  public:
41  virtual ~BlobSerializerBase() {}
42  using SerializationAcceptor =
43  std::function<void(const std::string& blobName, const std::string& data)>;
58  virtual void Serialize(const Blob& blob, const std::string& name,
59  SerializationAcceptor acceptor) = 0;
60 
61  virtual void SerializeWithChunkSize(
62  const Blob& blob,
63  const std::string& name,
64  SerializationAcceptor acceptor,
65  int /*chunk_size*/) {
66  // Base implementation.
67  Serialize(blob, name, acceptor);
68  }
69 };
70 
71 } // namespace caffe2
Blob is a general container that hosts a typed pointer.
Definition: blob.h:41
virtual void Serialize(const Blob &blob, const std::string &name, SerializationAcceptor acceptor)=0
The virtual function that returns a serialized string for the input blob.
Copyright (c) 2016-present, Facebook, Inc.
BlobSerializerBase is an abstract class that serializes a blob to a string.