提交 1c1d6f54 编写于 作者: J Justin Lebar 提交者: TensorFlower Gardener

Use or explicitly ignore tensorflow::Status objects.

Change: 150075644
上级 40d8721d
...@@ -469,7 +469,7 @@ TEST_F(BigQueryTableAccessorTest, SwitchingPartitionsTest) { ...@@ -469,7 +469,7 @@ TEST_F(BigQueryTableAccessorTest, SwitchingPartitionsTest) {
partition.set_start_index(3); partition.set_start_index(3);
partition.set_end_index(-1); partition.set_end_index(-1);
accessor_->SetPartition(partition); TF_EXPECT_OK(accessor_->SetPartition(partition));
TF_EXPECT_OK(accessor_->ReadRow(&row_id, &example)); TF_EXPECT_OK(accessor_->ReadRow(&row_id, &example));
EXPECT_EQ(3, row_id); EXPECT_EQ(3, row_id);
EXPECT_TRUE(accessor_->Done()); EXPECT_TRUE(accessor_->Done());
...@@ -478,7 +478,7 @@ TEST_F(BigQueryTableAccessorTest, SwitchingPartitionsTest) { ...@@ -478,7 +478,7 @@ TEST_F(BigQueryTableAccessorTest, SwitchingPartitionsTest) {
partition.set_start_index(0); partition.set_start_index(0);
partition.set_end_index(1); partition.set_end_index(1);
accessor_->SetPartition(partition); TF_EXPECT_OK(accessor_->SetPartition(partition));
TF_EXPECT_OK(accessor_->ReadRow(&row_id, &example)); TF_EXPECT_OK(accessor_->ReadRow(&row_id, &example));
EXPECT_EQ(0, row_id); EXPECT_EQ(0, row_id);
EXPECT_FALSE(accessor_->Done()); EXPECT_FALSE(accessor_->Done());
......
...@@ -168,9 +168,10 @@ class TestRemoteFusedGraphExecutor final : public IRemoteFusedGraphExecutor { ...@@ -168,9 +168,10 @@ class TestRemoteFusedGraphExecutor final : public IRemoteFusedGraphExecutor {
// TODO(satok): Read NAME_B from node_a_plus_b // TODO(satok): Read NAME_B from node_a_plus_b
const NodeDef& node_b = *node_def_map_.at(NAME_B); const NodeDef& node_b = *node_def_map_.at(NAME_B);
const TensorProto* proto = nullptr; const TensorProto* proto = nullptr;
GetNodeAttr(node_b, "value", &proto); TF_CHECK_OK(GetNodeAttr(node_b, "value", &proto));
Tensor const_tensor; Tensor const_tensor;
RemoteFusedGraphExecuteUtils::MakeTensorFromProto(*proto, &const_tensor); TF_CHECK_OK(RemoteFusedGraphExecuteUtils::MakeTensorFromProto(
*proto, &const_tensor));
const float b_val = *const_tensor.scalar<float>().data(); const float b_val = *const_tensor.scalar<float>().data();
Tensor output_a_plus_b(DT_FLOAT, {}); Tensor output_a_plus_b(DT_FLOAT, {});
output_a_plus_b.flat<float>().data()[0] = input_val + b_val; output_a_plus_b.flat<float>().data()[0] = input_val + b_val;
...@@ -258,7 +259,7 @@ TEST(RemoteFusedExecuteGraphOp, EndToEndTest) { ...@@ -258,7 +259,7 @@ TEST(RemoteFusedExecuteGraphOp, EndToEndTest) {
// 5.2 Fuse graph // 5.2 Fuse graph
GraphDef fused_graph; GraphDef fused_graph;
RewriteGraphToFusedGraph(original_graph, &fused_graph); TF_CHECK_OK(RewriteGraphToFusedGraph(original_graph, &fused_graph));
// 5.3 Setup session // 5.3 Setup session
std::vector<Tensor> output_tensors; std::vector<Tensor> output_tensors;
......
...@@ -269,7 +269,8 @@ RemoteFusedGraphExecuteUtils::AddOutputTensorShapeTypeByTensorShapeMap( ...@@ -269,7 +269,8 @@ RemoteFusedGraphExecuteUtils::AddOutputTensorShapeTypeByTensorShapeMap(
shape_inference::ShapeHandle handle; shape_inference::ShapeHandle handle;
status = context->MakeShapeFromTensorShape( status = context->MakeShapeFromTensorShape(
input_node_info.second.shape(), &handle); input_node_info.second.shape(), &handle);
shape_refiner->SetShape(node, 0, handle); // TODO(b/32704451): Don't just ignore this status!
shape_refiner->SetShape(node, 0, handle).IgnoreError();
is_input_node = true; is_input_node = true;
} }
if (!status.ok()) { if (!status.ok()) {
......
...@@ -19,6 +19,7 @@ limitations under the License. ...@@ -19,6 +19,7 @@ limitations under the License.
#include "tensorflow/core/common_runtime/shape_refiner.h" #include "tensorflow/core/common_runtime/shape_refiner.h"
#include "tensorflow/core/kernels/remote_fused_graph_execute_op_test_utils.h" #include "tensorflow/core/kernels/remote_fused_graph_execute_op_test_utils.h"
#include "tensorflow/core/lib/core/status.h" #include "tensorflow/core/lib/core/status.h"
#include "tensorflow/core/lib/core/status_test_util.h"
#include "tensorflow/core/platform/test.h" #include "tensorflow/core/platform/test.h"
namespace tensorflow { namespace tensorflow {
...@@ -188,34 +189,38 @@ TEST(RemoteFusedGraphExecuteUtils, PropagateAndBuildTensorShapeMap) { ...@@ -188,34 +189,38 @@ TEST(RemoteFusedGraphExecuteUtils, PropagateAndBuildTensorShapeMap) {
{ {
NodeDef* node_def = GetNodeDef(NAME_B, &def); NodeDef* node_def = GetNodeDef(NAME_B, &def);
TF_ASSERT_OK(
RemoteFusedGraphExecuteUtils::AddOutputTensorShapeTypeByTensorShapeMap( RemoteFusedGraphExecuteUtils::AddOutputTensorShapeTypeByTensorShapeMap(
tensor_shape_map, node_def); tensor_shape_map, node_def));
std::vector<DataType> data_types; std::vector<DataType> data_types;
GetNodeAttr(*node_def, RemoteFusedGraphExecuteUtils::ATTR_OUTPUT_DATA_TYPES, TF_ASSERT_OK(GetNodeAttr(
&data_types); *node_def, RemoteFusedGraphExecuteUtils::ATTR_OUTPUT_DATA_TYPES,
&data_types));
ASSERT_EQ(1, data_types.size()); ASSERT_EQ(1, data_types.size());
EXPECT_EQ(DT_FLOAT, data_types.at(0)); EXPECT_EQ(DT_FLOAT, data_types.at(0));
std::vector<TensorShape> shapes; std::vector<TensorShape> shapes;
GetNodeAttr(*node_def, RemoteFusedGraphExecuteUtils::ATTR_OUTPUT_SHAPES, TF_ASSERT_OK(GetNodeAttr(
&shapes); *node_def, RemoteFusedGraphExecuteUtils::ATTR_OUTPUT_SHAPES, &shapes));
ASSERT_EQ(1, shapes.size()); ASSERT_EQ(1, shapes.size());
EXPECT_EQ(0, shapes.at(0).dims()); EXPECT_EQ(0, shapes.at(0).dims());
} }
{ {
NodeDef* node_def = GetNodeDef(NAME_A_PLUS_B, &def); NodeDef* node_def = GetNodeDef(NAME_A_PLUS_B, &def);
TF_ASSERT_OK(
RemoteFusedGraphExecuteUtils::AddOutputTensorShapeTypeByTensorShapeMap( RemoteFusedGraphExecuteUtils::AddOutputTensorShapeTypeByTensorShapeMap(
tensor_shape_map, node_def); tensor_shape_map, node_def));
std::vector<DataType> data_types; std::vector<DataType> data_types;
GetNodeAttr(*node_def, RemoteFusedGraphExecuteUtils::ATTR_OUTPUT_DATA_TYPES, TF_ASSERT_OK(GetNodeAttr(
&data_types); *node_def, RemoteFusedGraphExecuteUtils::ATTR_OUTPUT_DATA_TYPES,
&data_types));
ASSERT_EQ(1, data_types.size()); ASSERT_EQ(1, data_types.size());
EXPECT_EQ(DT_FLOAT, data_types.at(0)); EXPECT_EQ(DT_FLOAT, data_types.at(0));
std::vector<TensorShape> shapes; std::vector<TensorShape> shapes;
GetNodeAttr(*node_def, RemoteFusedGraphExecuteUtils::ATTR_OUTPUT_SHAPES, TF_ASSERT_OK(GetNodeAttr(
&shapes); *node_def, RemoteFusedGraphExecuteUtils::ATTR_OUTPUT_SHAPES, &shapes));
ASSERT_EQ(1, shapes.size()); ASSERT_EQ(1, shapes.size());
EXPECT_EQ(0, shapes.at(0).dims()); EXPECT_EQ(0, shapes.at(0).dims());
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册