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