def backward():
    clear_particle_grad()
    compute_loss.grad()
    compute_x_avg.grad()
    for s in reversed(range((steps - 1))):
        clear_grid()
        p2g(s)
        grid_op()
        g2p.grad(s)
        grid_op.grad()
        p2g.grad(s)
        compute_actuation.grad()
def backward():
    clear_particle_grad()
    compute_loss.grad()
    compute_x_avg.grad()
    for s in reversed(range((steps - 1))):
        clear_grid()
        p2g(s)
        grid_op()
        g2p.grad(s)
        grid_op.grad()
        p2g.grad(s)
        compute_actuation.grad()