def discount_bootstrap(rewards_buffer, dones_buffer, final_values, discount_factor, number_of_steps):
    """ Calculate state values bootstrapping off the following state values """
    true_value_buffer = torch.zeros_like(rewards_buffer)

    # discount/bootstrap off value fn
    current_value = final_values

    for i in reversed(range(number_of_steps)):
        current_value = rewards_buffer[i] + discount_factor * current_value * (1.0 - dones_buffer[i])
        true_value_buffer[i] = current_value

    return true_value_buffer
def discount_bootstrap ( rewards_buffer , dones_buffer , final_values , discount_factor , number_of_steps ) : true_value_buffer = torch . zeros_like ( rewards_buffer ) current_value = final_values for i in reversed ( range ( number_of_steps ) ) : current_value = rewards_buffer [ i ] + discount_factor * current_value * ( 1.0 - dones_buffer [ i ] ) true_value_buffer [ i ] = current_value return true_value_buffer
Calculate state values bootstrapping off the following state values