Perform one SGD-with-momentum update using the (PyTorch-style) rule v←μv+g, then w←w−ηv.
Implement solve(w, v, grad, lr, mu).
Returns. Return a tuple (new_velocity, new_weights).
Example 1
Input:
solve([1.0], [0.0], [2.0], 0.1, 0.9)
Output:
([2.0], [0.8])
Example 2
Input:
solve([0.92], [2.0], [-1.0], 0.1, 0.9)
Output:
([0.8], [0.84])
No results yet
Run your code to check it against the examples, or submit to run every test.