aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/util/tensor_slice_reader.h
diff options
context:
space:
mode:
authorGravatar Sherry Moore <sherrym@google.com>2016-03-23 10:40:08 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-03-23 12:12:12 -0700
commit2966fcdae0cf7d75f4eca027f3003e355089b0ed (patch)
tree0b815993c33dd25b5d8c32ace77eb9e0431367f5 /tensorflow/core/util/tensor_slice_reader.h
parentf10637b372b3216400129b42abacd4fe50a6d7ea (diff)
Added Python APIs for inspecting checkpoint content.
DebugString() HasTensor() GetVariableToShapeMap() Example use can be found in PywrapTensorSliceReaderTest in third_party/tensorflow/python/training/saver_test.py For example, To use (in Python): try: reader = tf.train.NewCheckpointReader(your_checkpoint_file) print(reader.DebugString()) except pywrap_tensorflow.StatusNotOK as e: print(str(e)) Change: 117951901
Diffstat (limited to 'tensorflow/core/util/tensor_slice_reader.h')
-rw-r--r--tensorflow/core/util/tensor_slice_reader.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/tensorflow/core/util/tensor_slice_reader.h b/tensorflow/core/util/tensor_slice_reader.h
index 19f8bd068a..5dd0b2f919 100644
--- a/tensorflow/core/util/tensor_slice_reader.h
+++ b/tensorflow/core/util/tensor_slice_reader.h
@@ -62,6 +62,7 @@ class TensorSliceReader {
typedef std::function<Status(const string&, Table**)> OpenTableFunction;
static const int kLoadAllShards = -1;
+ TensorSliceReader(const string& filepattern);
TensorSliceReader(const string& filepattern, OpenTableFunction open_function);
TensorSliceReader(const string& filepattern, OpenTableFunction open_function,
int preferred_shard);
@@ -95,6 +96,13 @@ class TensorSliceReader {
return tensors_;
}
+ typedef std::unordered_map<string, TensorShape> VarToShapeMap;
+ // Returns a map from tensor name to shape.
+ VarToShapeMap GetVariableToShapeMap() const;
+
+ // Returns a string containing names and shapes of all the tensors.
+ const string DebugString() const;
+
private:
friend class TensorSliceWriteTestHelper;