Home | History | Annotate | Download | only in util
      1 // Protocol buffers for saved tensor slices. It's used for the brain tensor
      2 // ops checkpoints and the V3 checkpoints in dist_belief.
      3 
      4 // A checkpoint file is an sstable. The value for each record is a serialized
      5 // SavedTensorSlices message (defined below).
      6 //
      7 // Each checkpoint file has a record with the empty key (""), which corresponds
      8 // to a SavedTensorSlices message that contains a "meta", that serves as a
      9 // table of contents on all the tensor slices saved in this file. Since the key
     10 // is "", it's always the first record in each file.
     11 //
     12 // Each of the rest of the records in a checkpoint stores the raw data of a
     13 // particular tensor slice, in SavedSlice format. The corresponding key is an
     14 // ordered code that encodes the name of the tensor and the slice
     15 // information. The name is also stored in the SaveSlice message for ease of
     16 // debugging and manual examination.
     17 
     18 syntax = "proto3";
     19 
     20 package tensorflow;
     21 option cc_enable_arenas = true;
     22 option java_outer_classname = "SavedTensorSliceProtos";
     23 option java_multiple_files = true;
     24 option java_package = "org.tensorflow.util";
     25 
     26 import "tensorflow/core/framework/tensor_shape.proto";
     27 import "tensorflow/core/framework/tensor_slice.proto";
     28 import "tensorflow/core/framework/tensor.proto";
     29 import "tensorflow/core/framework/types.proto";
     30 import "tensorflow/core/framework/versions.proto";
     31 
     32 // Metadata describing the set of slices of the same tensor saved in a
     33 // checkpoint file.
     34 message SavedSliceMeta {
     35   // Name of the tensor.
     36   string name = 1;
     37 
     38   // Shape of the tensor
     39   TensorShapeProto shape = 2;
     40 
     41   // Type of the tensor
     42   DataType type = 3;
     43 
     44   // Explicit list of slices saved in the checkpoint file.
     45   repeated TensorSliceProto slice = 4;
     46 };
     47 
     48 // Metadata describing the set of tensor slices saved in a checkpoint file.
     49 // It is always stored at the beginning of each checkpoint file.
     50 message SavedTensorSliceMeta {
     51   // Each SavedSliceMeta describes the slices for one tensor.
     52   repeated SavedSliceMeta tensor = 1;
     53 
     54   // Compatibility version of this checkpoint.  See core/public/version.h
     55   // for version history.
     56   VersionDef versions = 2;
     57 };
     58 
     59 // Saved tensor slice: it stores the name of the tensors, the slice, and the
     60 // raw data.
     61 message SavedSlice {
     62   // Name of the tensor that this slice belongs to. This must be identical to
     63   // the name used to encode the key for this record.
     64   string name = 1;
     65 
     66   // Extent of the slice.  Must have one entry for each of the dimension of the
     67   // tensor that this slice belongs to.
     68   TensorSliceProto slice = 2;
     69 
     70   // The raw data of the slice is stored as a TensorProto. Only raw data are
     71   // stored (we don't fill in fields such as dtype or tensor_shape).
     72   TensorProto data = 3;
     73 };
     74 
     75 // Each record in a v3 checkpoint file is a serialized SavedTensorSlices
     76 // message.
     77 message SavedTensorSlices {
     78   // This is only present at the first item of each checkpoint file and serves
     79   // as a table of contents, listing all the tensor slices saved in this file.
     80   SavedTensorSliceMeta meta = 1;
     81 
     82   // This exists in all but the first item of each checkpoint file.
     83   SavedSlice data = 2;
     84 };
     85