Closed schonkopf closed 3 years ago
I was running sparse NMF using the following codes:
net = NMF(data.shape, rank=self.basis_num).cuda() net.sparse_fit(data.cuda(), verbose=True, max_iter=200, beta=1, sW=0.3)
Error message occurs: /content/pytorchNMF/torchnmf/nmf.py in sparse_fit(self, V, beta, max_iter, verbose, sW, sH) 378 W.grad = None 379 WH = self.reconstruct(H.detach(), W) --> 380 loss = beta_div(self.fix_neg(WH), V, beta) 381 loss.backward() 382 with torch.no_grad():
/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in getattr(self, name) 777 return modules[name] 778 raise ModuleAttributeError("'{}' object has no attribute '{}'".format( --> 779 type(self).name, name)) 780 781 def setattr(self, name: str, value: Union[Tensor, 'Module']) -> None:
ModuleAttributeError: 'NMF' object has no attribute 'fix_neg'
Good catch! Will commit a hot fix asap.
@schonkopf The new commit 92d20ce34392052f27f4ee526c1acb9f60a33261 should solve the issue.
I was running sparse NMF using the following codes:
Error message occurs: /content/pytorchNMF/torchnmf/nmf.py in sparse_fit(self, V, beta, max_iter, verbose, sW, sH) 378 W.grad = None 379 WH = self.reconstruct(H.detach(), W) --> 380 loss = beta_div(self.fix_neg(WH), V, beta) 381 loss.backward() 382 with torch.no_grad():
/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in getattr(self, name) 777 return modules[name] 778 raise ModuleAttributeError("'{}' object has no attribute '{}'".format( --> 779 type(self).name, name)) 780 781 def setattr(self, name: str, value: Union[Tensor, 'Module']) -> None:
ModuleAttributeError: 'NMF' object has no attribute 'fix_neg'