Premium problem56. Manual SGD Parameter Update

Easy Locked

Given a parameter tensor param, its gradient grad, and a learning rate lr, return the parameter after one plain gradient-descent update step: param - lr * grad.

Input

param = tensor([1., 2., 3.])
grad = tensor([ 0.1000, -0.2000,  0.0500])
lr = 0.1

Output

tensor([0.9900, 2.0200, 2.9950])

Premium problem

This one's part of Premium. Unlock the full PyTorch track plus every other premium problem on the site.

Implement solve(...)