MediaBrain-SJTU / RegAD

[ECCV2022 Oral] Registration based Few-Shot Anomaly Detection
MIT License
278 stars 40 forks source link

AttributeError: module 'torch' has no attribute 'cov' #3

Closed dgl547437235 closed 2 years ago

dgl547437235 commented 2 years ago

hi,which torch version should i install, i try 1.12.0 and 1.8.0,but still casuse the problem

chaoqinhuang commented 2 years ago

Pytorch version should >=1.10.0 for torch.cov according to the official pytorch documentation. https://pytorch.org/docs/1.12/generated/torch.cov.html?highlight=torch%20cov#torch.cov Please double-check if your pytorch is well installed and if you run the correct pytorch version.

wzr0108 commented 2 years ago

you can use this code instead

tmp = np.cov(embedding_vectors[:, :, i].T.cpu().numpy())
cov[:, :, i] = torch.from_numpy(tmp).to(cov.device) + 0.01 * I