Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify code for TensorListConcatLists shape inference #31079

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 5 additions & 6 deletions tensorflow/core/ops/list_ops.cc
Expand Up @@ -590,18 +590,17 @@ REGISTER_OP("TensorListConcatLists")

auto* handle_data_a = c->input_handle_shapes_and_types(0);
auto* handle_data_b = c->input_handle_shapes_and_types(1);
if ((handle_data_a == nullptr || handle_data_a->empty()) &&
(handle_data_b == nullptr || handle_data_b->empty())) {
bool handle_data_a_nonempty = handle_data_a && !handle_data_a->empty();
bool handle_data_b_nonempty = handle_data_b && !handle_data_b->empty();
if (!(handle_data_a_nonempty || handle_data_b_nonempty)) {
c->set_output_handle_shapes_and_types(
0, {{c->UnknownShape(), element_dtype}});
return Status::OK();
}
shape_inference::ShapeAndType list_shape_type_a =
(handle_data_a && !handle_data_a->empty()) ? handle_data_a->at(0)
: handle_data_b->at(0);
handle_data_a_nonempty ? handle_data_a->at(0) : handle_data_b->at(0);
const shape_inference::ShapeAndType& list_shape_type_b =
(handle_data_b && !handle_data_b->empty()) ? handle_data_b->at(0)
: handle_data_a->at(0);
handle_data_b_nonempty ? handle_data_b->at(0) : handle_data_a->at(0);
if (list_shape_type_a.dtype != element_dtype) {
return errors::InvalidArgument("input_a.type != element_dtype: ",
DataTypeString(list_shape_type_a.dtype),
Expand Down