Skip to content

Commit

Permalink
[TF] NodeDefs without an op name are invalid, return error on import
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 453711926
  • Loading branch information
tensorflower-gardener committed Jun 8, 2022
1 parent 7709a78 commit a0f0b9a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tensorflow/core/ir/importexport/graphdef_import.cc
Expand Up @@ -746,6 +746,9 @@ StatusOr<unsigned> GraphDefImporter::ArgNumType(const NamedAttrList &attrs,
Status GraphDefImporter::ConvertNodeDef(OpBuilder &builder, ConversionState &s,
const NodeDef &node) {
VLOG(4) << "Importing: " << node.name();
if (node.op().empty())
return InvalidArgument("Node ", node.name(), " has an empty op name");

OperationState state(ConvertLocation(node), absl::StrCat("tfg.", node.op()));

// The GraphImporter does light shape inference, but here we will defer all of
Expand Down
@@ -0,0 +1,20 @@
# RUN: not tfg-translate -graphdef-to-mlir %s 2>&1 | FileCheck %s

# CHECK: Node has an empty op name

library {
function {
signature {
name: "\\344\\264\\264"
description: "value"
is_distributed_communication: true
}
node_def {
input: "|"
}
control_ret {
key: ""
value: ""
}
}
}

0 comments on commit a0f0b9a

Please sign in to comment.