diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-08-31 14:35:47 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-08-31 14:56:33 -0700 |
commit | e082d5208e56d3d8f69544781bebf830eae82de7 (patch) | |
tree | 8bdf5a08ebb7fa41a16c00c7f6b5921d9bc54555 /tensorflow/core/lib | |
parent | 8341a69d25a6f09b57e866e802efd2eb7d588c78 (diff) |
Currently there are two formats for error reporting inside TensorFlow. This is first of a series of CL to merge these into one. In this change, we remove the format tag from the errors.
PiperOrigin-RevId: 211146036
Diffstat (limited to 'tensorflow/core/lib')
-rw-r--r-- | tensorflow/core/lib/core/errors.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/tensorflow/core/lib/core/errors.h b/tensorflow/core/lib/core/errors.h index 49a8a4dbd4..982901a39c 100644 --- a/tensorflow/core/lib/core/errors.h +++ b/tensorflow/core/lib/core/errors.h @@ -131,11 +131,25 @@ inline string FormatNodeNameForError(const string& name) { // LINT.ThenChange(//tensorflow/python/client/session.py) template <typename T> string FormatNodeNamesForError(const T& names) { - ::tensorflow::str_util::Formatter<string> f( - [](string* output, const string& s) { + return ::tensorflow::str_util::Join( + names, ", ", [](string* output, const string& s) { ::tensorflow::strings::StrAppend(output, FormatNodeNameForError(s)); }); - return ::tensorflow::str_util::Join(names, ", ", f); +} +// TODO(b/113350742): Consolidate the two different formats `{{key value}}` and +// `^^key:value^^` in a follow-on CL. +// LINT.IfChange +inline string FormatColocationNodeForError(const string& name) { + return strings::StrCat("^^colocation_node:", name, "^^"); +} +// LINT.ThenChange(//tensorflow/python/framework/error_interpolation.py) +template <typename T> +string FormatColocationNodeForError(const T& names) { + return ::tensorflow::str_util::Join( + names, ", ", [](string* output, const string& s) { + ::tensorflow::strings::StrAppend(output, + FormatColocationNodeForError(s)); + }); } // The CanonicalCode() for non-errors. |