• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1syntax = "proto3";
2
3package tensorflow;
4option cc_enable_arenas = true;
5option java_outer_classname = "TensorBundleProtos";
6option java_multiple_files = true;
7option java_package = "org.tensorflow.util";
8option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf";
9import "tensorflow/core/framework/tensor_shape.proto";
10import "tensorflow/core/framework/tensor_slice.proto";
11import "tensorflow/core/framework/types.proto";
12import "tensorflow/core/framework/versions.proto";
13
14// Protos used in the tensor bundle module (tf/core/util/tensor_bundle/).
15
16// Special header that is associated with a bundle.
17//
18// TODO(zongheng,zhifengc): maybe in the future, we can add information about
19// which binary produced this checkpoint, timestamp, etc. Sometime, these can be
20// valuable debugging information. And if needed, these can be used as defensive
21// information ensuring reader (binary version) of the checkpoint and the writer
22// (binary version) must match within certain range, etc.
23message BundleHeaderProto {
24  // Number of data files in the bundle.
25  int32 num_shards = 1;
26
27  // An enum indicating the endianness of the platform that produced this
28  // bundle.  A bundle can only be read by a platform with matching endianness.
29  // Defaults to LITTLE, as most modern platforms are little-endian.
30  //
31  // Affects the binary tensor data bytes only, not the metadata in protobufs.
32  enum Endianness {
33    LITTLE = 0;
34    BIG = 1;
35  }
36  Endianness endianness = 2;
37
38  // Versioning of the tensor bundle format.
39  VersionDef version = 3;
40}
41
42// Describes the metadata related to a checkpointed tensor.
43message BundleEntryProto {
44  // The tensor dtype and shape.
45  DataType dtype = 1;
46  TensorShapeProto shape = 2;
47  // The binary content of the tensor lies in:
48  //   File "shard_id": bytes [offset, offset + size).
49  int32 shard_id = 3;
50  int64 offset = 4;
51  int64 size = 5;
52
53  // The CRC32C checksum of the tensor bytes.
54  fixed32 crc32c = 6;
55
56  // Iff present, this entry represents a partitioned tensor.  The previous
57  // fields are interpreted as follows:
58  //
59  //   "dtype", "shape": describe the full tensor.
60  //   "shard_id", "offset", "size", "crc32c": all IGNORED.
61  //      These information for each slice can be looked up in their own
62  //      BundleEntryProto, keyed by each "slice_name".
63  repeated TensorSliceProto slices = 7;
64}
65