| 26 | const char kSavedTensorSlicesKey[] = ""; |
| 27 | |
| 28 | string EncodeTensorNameSlice(const string& name, const TensorSlice& slice) { |
| 29 | string buffer; |
| 30 | // All the tensor slice keys will start with a 0 |
| 31 | tensorflow::strings::OrderedCode::WriteNumIncreasing(&buffer, 0); |
| 32 | tensorflow::strings::OrderedCode::WriteString(&buffer, name); |
| 33 | tensorflow::strings::OrderedCode::WriteNumIncreasing(&buffer, slice.dims()); |
| 34 | for (int d = 0; d < slice.dims(); ++d) { |
| 35 | // A trivial extent (meaning we take EVERYTHING) will default to -1 for both |
| 36 | // start and end. These will be properly parsed. |
| 37 | tensorflow::strings::OrderedCode::WriteSignedNumIncreasing(&buffer, |
| 38 | slice.start(d)); |
| 39 | tensorflow::strings::OrderedCode::WriteSignedNumIncreasing(&buffer, |
| 40 | slice.length(d)); |
| 41 | } |
| 42 | return buffer; |
| 43 | } |
| 44 | |
| 45 | Status DecodeTensorNameSlice(const string& code, string* name, |
| 46 | tensorflow::TensorSlice* slice) { |