def _fix_step_size(value_and_gradients_function,<EOL>val_c_input,<EOL>active,<EOL>step_size_shrink_param):
<EOL>iter_max = np.ceil(-np.log2(_machine_eps(val_c_input.x.dtype)))<EOL>def _cond(i, val_c, to_fix):<EOL><INDENT>del val_c  <EOL>return (i < iter_max) & tf.reduce_any(input_tensor=to_fix)<EOL><DEDENT>def _body(i, val_c, to_fix):<EOL><INDENT>next_c = tf.where(to_fix, val_c.x * step_size_shrink_param, val_c.x)<EOL>next_val_c = value_and_gradients_function(next_c)<EOL>still_to_fix = to_fix & ~hzl.is_finite(next_val_c)<EOL>return (i + <NUM_LIT:1>, next_val_c, still_to_fix)<EOL><DEDENT>to_fix = active & ~hzl.is_finite(val_c_input)<EOL>return tf.while_loop(<EOL>cond=_cond, body=_body, loop_vars=(<NUM_LIT:0>, val_c_input, to_fix))<EOL>
Shrinks the input step size until the value and grad become finite.