Including attributes in the error message in case of attributes mismatch.

PiperOrigin-RevId: 221870891
This commit is contained in:
A. Unique TensorFlower 2018-11-16 16:25:04 -08:00 committed by TensorFlower Gardener
parent de8ebdb12f
commit db1b3aafc0
3 changed files with 9 additions and 2 deletions

View File

@ -102,6 +102,10 @@ string SummarizeNodeDef(const NodeDef& node_def) {
return ret;
}
string SummarizeAttrs(const NodeDef& node_def) {
return SummarizeAttrsHelper(node_def, node_def.device());
}
string FormatNodeForError(const Node& node) {
return FormatNodeDefForError(node.def());
}

View File

@ -48,6 +48,7 @@ extern const char* const kColocationGroupPrefix;
// than a text-format proto.
string SummarizeNode(const Node& node);
string SummarizeNodeDef(const NodeDef& node_def);
string SummarizeAttrs(const NodeDef& node_def);
// Produces a formatted string pattern from the node which can uniquely identify
// this node upstream to produce an informative error message. The pattern

View File

@ -1127,7 +1127,8 @@ Status FindKernelDef(const DeviceType& device_type, const NodeDef& node_def,
FormatNodeDefForError(node_def));
if (was_attr_mismatch) {
errors::AppendToMessage(
&s, " (OpKernel was found, but attributes didn't match)");
&s, " (OpKernel was found, but attributes didn't match) ",
"Requested Attributes: ", SummarizeAttrs(node_def));
}
errors::AppendToMessage(
&s, ". Registered:", KernelsRegisteredForOp(node_def.op()));
@ -1262,7 +1263,8 @@ Status CreateOpKernel(DeviceType device_type, DeviceBase* device,
FormatNodeDefForError(node_def)));
if (was_attr_mismatch) {
errors::AppendToMessage(
&s, " (OpKernel was found, but attributes didn't match)");
&s, " (OpKernel was found, but attributes didn't match) ",
"Requested Attributes: ", SummarizeAttrs(node_def));
}
errors::AppendToMessage(
&s, ". Registered:", KernelsRegisteredForOp(node_def.op()));