Better HN
topnewbestaskshowjobs
Log inSign up

JarreNael

3 karma · joined May 11, 2022 (4y ago) · 1 submissions

Submissions

comment 4y ago · link · parent

In PyTorch:

  a = torch.tensor([2., 3.], requires_grad=True)
  b = torch.tensor([6., 4.], requires_grad=True)
  Q = 3*a**3 - b**2
  external_grad = torch.tensor([1., 1.])
  Q.backward(gradient=external_grad)
  print(a.grad, b.grad) # the computed gradients.
All this is done on the GPU. Automatic Differentiation is the workhorse of modern NN.