diff --git a/tensorflow/compiler/tf2xla/const_analysis.cc b/tensorflow/compiler/tf2xla/const_analysis.cc index 48513a43fb..fe68402aca 100644 --- a/tensorflow/compiler/tf2xla/const_analysis.cc +++ b/tensorflow/compiler/tf2xla/const_analysis.cc @@ -61,13 +61,15 @@ Status GetFunctionBodies(FunctionLibraryRuntime* flib_runtime, Status CondConstInputIndices( absl::Span branch_bodies, - std::vector* const_input_idxs, FunctionLibraryRuntime* flib_runtime) { - TF_RET_CHECK(!branch_bodies.empty()); + TF_RET_CHECK(branch_bodies[0] != nullptr); + std::vector* const_input_idxs, FunctionLibraryRuntime* flib_runtime) { + TF_RET_CHECK(!branch_bodies.empty() && branch_bodies[0] != nullptr); + int num_inputs = branch_bodies[0]->fdef.signature().input_arg_size(); // Stores indices of the "branch function" inputs that are expected to be // compile time constants. - std::vector compile_time_const_arg_indices(num_inputs); + std::vector compile_time_const_arg_indices(num_inputs, false); for (auto fbody : branch_bodies) { TF_RET_CHECK(fbody != nullptr); TF_RETURN_IF_ERROR(BackwardsConstAnalysis(