1 /* Copyright 2016 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 // A minimal library exposing the naming logic used in tensor_bundle. 17 // 18 // A tensor bundle contains a metadata file and sharded data files, which all 19 // share a common pathname prefix. 20 // 21 // Given the prefix, the actual pathnames of the files can be queried via: 22 // 23 // MetaFilename(prefix): pathname of the metadata file. 24 // DataFilename(prefix, shard_id, num_shards): pathname of a data file. 25 // 26 // Typical usage includes forming a filepattern to match files on disk: 27 // 28 // // To find the unique metadata file. 29 // const string metadata_file = MetaFilename("/fs/train/ckpt-step"); 30 // Env::Default()->GetMatchingFiles(metadata_file, &path); 31 // 32 // Regexp can also be used: e.g. R"<prefix>.data-\d{5}-of-\d{5}" for data files. 33 34 #ifndef TENSORFLOW_CORE_UTIL_TENSOR_BUNDLE_NAMING_H_ 35 #define TENSORFLOW_CORE_UTIL_TENSOR_BUNDLE_NAMING_H_ 36 37 #include "tensorflow/core/lib/core/stringpiece.h" 38 #include "tensorflow/core/platform/types.h" 39 40 namespace tensorflow { 41 42 string MetaFilename(StringPiece prefix); 43 string DataFilename(StringPiece prefix, int32 shard_id, int32 num_shards); 44 45 } // namespace tensorflow 46 47 #endif // TENSORFLOW_CORE_UTIL_TENSOR_BUNDLE_NAMING_H_ 48