提交 0e1ff10e 编写于 作者: M Manjunath Kudlur 提交者: TensorFlower Gardener

Check for error status after NodeBuilder::Finalize.

Fixes #5871
Change: 141475958
上级 158f2a72
......@@ -695,6 +695,7 @@ string OpInfo::GetConstructorBody() const {
strings::StrAppend(&body, " ", scope_str, ".UpdateBuilder(&builder);\n");
strings::StrAppend(&body, " ", scope_str, ".UpdateStatus(builder.Finalize(",
scope_str, ".graph(), &ret));\n");
strings::StrAppend(&body, " ", return_on_error, "\n");
// TODO(b/28152992): Enable this code-path once we have converted
// all python shape functions to call their C++ versions.
......
......@@ -238,4 +238,15 @@ TEST(CCOpTest, EmptyConst) {
EXPECT_FALSE(root.status().ok());
}
TEST(CCOpTest, InvalidFinalize) {
Scope root = Scope::NewRootScope();
auto read_up_to =
ops::ReaderReadUpTo(root, Variable(root, {}, DT_STRING),
Variable(root, {}, DT_STRING), static_cast<int32>(2));
EXPECT_FALSE(root.status().ok());
auto err_msg = root.status().error_message();
EXPECT_NE(err_msg.find("'num_records' passed int32 expected int64"),
string::npos);
}
} // namespace tensorflow
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册