Implement momentum SGD by subclassing the PyTorch optimizer interface and maintaining per-parameter velocity.