Simulate gradient accumulation over multiple micro-batches, and return the final weights and last averaged gradient.