Computational Physics, Python, Linear Algebra, Svd, Code.
tensor([[27., 27.], [27., 27.]], grad_fn=<MulBackward0>) tensor(108., grad_fn=<SumBackward0>) out.backward() print(x.grad) tensor([[18., 18.], [18., 18.]]) Using Autograd for NMF lam=1e6 pW = Variable(tc.FloatTensor(m,d), requires_grad=True) pH = Variable(tc.FloatTensor(d,n), requires_grad=True)