diff --git a/tensorflow/core/framework/node_def_util.cc b/tensorflow/core/framework/node_def_util.cc index 578ec7f2e4d..95a787b2df0 100644 --- a/tensorflow/core/framework/node_def_util.cc +++ b/tensorflow/core/framework/node_def_util.cc @@ -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()); } diff --git a/tensorflow/core/framework/node_def_util.h b/tensorflow/core/framework/node_def_util.h index 0ff67554eb3..f682bb15355 100644 --- a/tensorflow/core/framework/node_def_util.h +++ b/tensorflow/core/framework/node_def_util.h @@ -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 diff --git a/tensorflow/core/framework/op_kernel.cc b/tensorflow/core/framework/op_kernel.cc index 1213e25116a..e3cb4a40ec5 100644 --- a/tensorflow/core/framework/op_kernel.cc +++ b/tensorflow/core/framework/op_kernel.cc @@ -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()));