質問編集履歴

1

エラーのコードミス

2020/05/30 09:45

投稿

Hiro051
Hiro051

スコア9

test CHANGED
File without changes
test CHANGED
@@ -25,44 +25,6 @@
25
25
  ```
26
26
 
27
27
  $ python AlexNet.py
28
-
29
- Traceback (most recent call last):
30
-
31
- File "AlexNet.py", line 118, in <module>
32
-
33
- for i, (images, labels) in enumerate(train_loader):
34
-
35
- File "/home/selen/.pyenv/versions/3.7.3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 582, in __next__
36
-
37
- return self._process_next_batch(batch)
38
-
39
- File "/home/selen/.pyenv/versions/3.7.3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 606, in _process_next_batch
40
-
41
- raise Exception("KeyError:" + batch.exc_msg)
42
-
43
- Exception: KeyError:Traceback (most recent call last):
44
-
45
- File "/home/selen/.pyenv/versions/3.7.3/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop
46
-
47
- samples = collate_fn([dataset[i] for i in batch_indices])
48
-
49
- File "/home/selen/.pyenv/versions/3.7.3/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 99, in <listcomp>
50
-
51
- samples = collate_fn([dataset[i] for i in batch_indices])
52
-
53
- File "/home/selen/.pyenv/versions/3.7.3/lib/python3.7/site-packages/torch/utils/data/dataset.py", line 107, in __getitem__
54
-
55
- return self.dataset[self.indices[idx]]
56
-
57
- File "AlexNet.py", line 32, in __getitem__
58
-
59
- label = self.class_map[self.data[idx]["label"]]
60
-
61
- KeyError: 'EMCI'
62
-
63
-
64
-
65
- selen@penny:~/workspace$ python AlexNet.py
66
28
 
67
29
  Traceback (most recent call last):
68
30