batch inputs in python by forward_all() and forward_backward_all()