AttributeError: 'torch.dtype' object has no attribute 'type'
Closed this issue · 16 comments
Hello, when I tested, I encountered the following problem。
Traceback (most recent call last):
File "D:/yy/2019.3-/code/CovaMNet-master/CovaMNet_Test_5way1shot.py", line 293, in
test_accuracy, h = mean_confidence_interval(accuracies)
File "D:/yy/2019.3-/code/CovaMNet-master/CovaMNet_Test_5way1shot.py", line 246, in mean_confidence_interval
m, se = np.mean(a), scipy.stats.sem(a)
File "D:\Program\Anaconda3\envs\env_name\lib\site-packages\numpy\core\fromnumeric.py", line 3118, in mean
out=out, **kwargs)
File "D:\Program\Anaconda3\envs\env_name\lib\site-packages\numpy\core_methods.py", line 85, in _mean
ret = ret.dtype.type(ret / rcount)
AttributeError: 'torch.dtype' object has no attribute 'type'
I tried to make some changes, replacing np.mean(a) with torch.mean(torch.stack(a)), but there are still other problems.
I will be great appreciate that if you can tell me how to solve this problem.
Hi, this may be caused by the different versions of Pytorch. I have modified the function mean_confidence_interval. Can you try this new test file? If you have any problem, please let me know.
是的,不好意思,这个问题的原因在于一次性采样了300000个episodes,所以导致系统open files过多,我近期会重新修改一下,如果你着急,可以参考我github主页CVPR19的代码把代码修改成epoch模式,问题应该就解决了。
不客气呢
你好,我已经把代码修改过了。你现在可以重新试试看,如果有问题,还望告知
我暂时还不太清楚,我之前没遇到过这个错误,我这两天会系统的测试一下,包括在新版本下,然后再告诉你可行
你好,不好意思,现在才回复,先问一下之前的问题还存在么,我在其实版本的pytorch的版本上进行了测试,好像没什么问题,我又重新更新了一下代码。请问一下你用的是windows系统么 https://discuss.pytorch.org/t/brokenpipeerror-errno-32-broken-pipe-on-windows-and-cuda-10/35894
你看一下这个链接呢,我查了一下好像是系统的问题,如果linux系统应该是没问题的,我在ubuntu下做了很多测试,应该是没问题的