def _line_search_inner_bisection(<EOL>value_and_gradients_function,<EOL>search_interval,<EOL>active,<EOL>f_lim):
midpoint = (search_interval.left.x + search_interval.right.x) / <NUM_LIT:2><EOL>val_mid = value_and_gradients_function(midpoint)<EOL>is_valid_mid = hzl.is_finite(val_mid)<EOL>still_active = active & is_valid_mid<EOL>new_failed = active & ~is_valid_mid<EOL>next_inteval = search_interval._replace(<EOL>failed=search_interval.failed | new_failed,<EOL>func_evals=search_interval.func_evals + <NUM_LIT:1>)<EOL>def _apply_update():<EOL><INDENT>update_result = hzl.update(<EOL>value_and_gradients_function, next_inteval.left, next_inteval.right,<EOL>val_mid, f_lim, active=still_active)<EOL>return HagerZhangLineSearchResult(<EOL>converged=next_inteval.converged,<EOL>failed=next_inteval.failed | update_result.failed,<EOL>iterations=next_inteval.iterations + update_result.iteration,<EOL>func_evals=next_inteval.func_evals + update_result.num_evals,<EOL>left=update_result.left,<EOL>right=update_result.right)<EOL><DEDENT>return prefer_static.cond(<EOL>tf.reduce_any(input_tensor=still_active),<EOL>_apply_update,<EOL>lambda: next_inteval)<EOL>
Performs bisection and updates the interval.