aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/util/saved_tensor_slice.proto
blob: f6599d966986fa3495b200c59da01bf91fd24ca1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Protocol buffers for saved tensor slices. It's used for the brain tensor
// ops checkpoints and the V3 checkpoints in dist_belief.

// A checkpoint file is an sstable. The value for each record is a serialized
// SavedTensorSlices message (defined below).
//
// Each checkpoint file has a record with the empty key (""), which corresponds
// to a SavedTensorSlices message that contains a "meta", that serves as a
// table of contents on all the tensor slices saved in this file. Since the key
// is "", it's always the first record in each file.
//
// Each of the rest of the records in a checkpoint stores the raw data of a
// particular tensor slice, in SavedSlice format. The corresponding key is an
// ordered code that encodes the name of the tensor and the slice
// information. The name is also stored in the SaveSlice message for ease of
// debugging and manual examination.

syntax = "proto3";

package tensorflow;
// option cc_enable_arenas = true;

import "tensorflow/core/framework/tensor_shape.proto";
import "tensorflow/core/framework/tensor_slice.proto";
import "tensorflow/core/framework/tensor.proto";
import "tensorflow/core/framework/types.proto";

// Metadata describing the set of slices of the same tensor saved in a
// checkpoint file.
message SavedSliceMeta {
  // Name of the tensor.
  string name = 1;

  // Shape of the tensor
  TensorShapeProto shape = 2;

  // Type of the tensor
  DataType type = 3;

  // Explicit list of slices saved in the checkpoint file.
  repeated TensorSliceProto slice = 4;
};

// Metadata describing the set of tensor slices saved in a checkpoint file.
// It is always stored at the beginning of each checkpoint file.
message SavedTensorSliceMeta {
  // Each SavedSliceMeta describes the slices for one tensor.
  repeated SavedSliceMeta tensor = 1;
};

// Saved tensor slice: it stores the name of the tensors, the slice, and the
// raw data.
message SavedSlice {
  // Name of the tensor that this slice belongs to. This must be identical to
  // the name used to encode the key for this record.
  string name = 1;

  // Extent of the slice.  Must have one entry for each of the dimension of the
  // tensor that this slice belongs to.
  TensorSliceProto slice = 2;

  // The raw data of the slice is stored as a TensorProto. Only raw data are
  // stored (we don't fill in fields such as dtype or tensor_shape).
  TensorProto data = 3;
};

// Each record in a v3 checkpoint file is a serialized SavedTensorSlices
// message.
message SavedTensorSlices {
  // This is only present at the first item of each checkpoint file and serves
  // as a table of contents, listing all the tensor slices saved in this file.
  SavedTensorSliceMeta meta = 1;

  // This exists in all but the first item of each checkpoint file.
  SavedSlice data = 2;
};