Remove deprecated resource handle functions in InferenceContext.

PiperOrigin-RevId: 158034419
This commit is contained in:
A. Unique TensorFlower 2017-06-05 10:59:53 -07:00 committed by TensorFlower Gardener
parent 9f932e6ce6
commit afdc38cd30
3 changed files with 5 additions and 34 deletions

View File

@ -881,14 +881,6 @@ Status InferenceContext::AttachContext(const Status& status) {
strings::StrCat(status.error_message(), error_context));
}
ShapeHandle InferenceContext::input_handle_shape(int idx) {
if (input_handle_shapes_and_types_[idx] == nullptr) {
input_handle_shapes_and_types_[idx].reset(
new std::vector<ShapeAndType>{{UnknownShape(), DT_INVALID}});
}
return (*input_handle_shapes_and_types_[idx])[0].shape;
}
bool InferenceContext::MergeHandleShapesAndTypes(
const std::vector<ShapeAndType>& shapes_and_types,
std::vector<ShapeAndType>* to_update) {

View File

@ -491,37 +491,12 @@ class InferenceContext {
return input_handle_shapes_and_types_[idx].get();
}
// DEPRECATED: use input_handle_shapes_and_types.
ShapeHandle input_handle_shape(int idx);
// DEPRECATED: use input_handle_shapes_and_types.
DataType input_handle_dtype(int idx) const {
if (input_handle_shapes_and_types_[idx] == nullptr) {
return DT_INVALID;
} else {
DCHECK_EQ(input_handle_shapes_and_types_[idx]->size(), 1);
return (*input_handle_shapes_and_types_[idx])[0].dtype;
}
}
void set_output_handle_shapes_and_types(
int idx, const std::vector<ShapeAndType>& shapes_and_types) {
output_handle_shapes_and_types_[idx].reset(
new std::vector<ShapeAndType>(shapes_and_types));
}
// DEPRECATED: use output_handle_shapes_and_types.
ShapeHandle output_handle_shape(int idx) {
return output_handle_shapes_and_types_[idx] == nullptr
? UnknownShape()
: (*output_handle_shapes_and_types_[idx])[0].shape;
}
// DEPRECATED: use output_handle_shapes_and_types.
DataType output_handle_dtype(int idx) const {
return output_handle_shapes_and_types_[idx] == nullptr
? DT_INVALID
: (*output_handle_shapes_and_types_[idx])[0].dtype;
}
// Note that shape functions should usually call MakeShapeFromShapeTensor,
// as it does more analysis to provide partial shapes.
//

View File

@ -175,7 +175,11 @@ TEST(ArrayOpsTest, Identity_ShapeFnHandles) {
TF_ASSERT_OK(c.construction_status());
ASSERT_TRUE(op_reg_data->shape_inference_fn != nullptr);
TF_ASSERT_OK(c.Run(op_reg_data->shape_inference_fn));
EXPECT_TRUE(c.output_handle_dtype(0) == DT_BOOL);
const auto* shapes_and_types = c.output_handle_shapes_and_types(0);
ASSERT_TRUE(shapes_and_types != nullptr);
ASSERT_EQ(1, shapes_and_types->size());
EXPECT_EQ((*shapes_and_types)[0].dtype, DT_BOOL);
}
TEST(ArrayOpsTest, Diag_ShapeFn) {