質問編集履歴

3

訂正しましたすんまそん。

2021/06/10 09:32

投稿

ques346
ques346

スコア47

test CHANGED
File without changes
test CHANGED
@@ -66,13 +66,13 @@
66
66
 
67
67
 
68
68
 
69
- plt.figure(figsize=(400,400))
69
+ plt.figure(figsize=(100,100))
70
70
 
71
71
 
72
72
 
73
73
  for i in range(len(out_img)):
74
74
 
75
- plt.subplot(17, 60, i+1).imshow(out_img[i])
75
+ plt.subplot(20, 20, i+1).imshow(out_img[i])
76
76
 
77
77
 
78
78
 
@@ -118,11 +118,11 @@
118
118
 
119
119
 
120
120
 
121
- out_data_list = [[]]
121
+ out_data_list = [[0]] * len(out_img)
122
-
122
+
123
- for i in range(len(out_data_list)):
123
+ for i in range(len(out_img)):
124
-
124
+
125
- out_data_list[i].append([0] + diff(extract(out_img[i], 1)) + diff(extract(out_img[i], 2)) + diff(extract(out_img[i], 0)))
125
+ out_data_list[i].append(diff(extract(out_img[i], 1)) + diff(extract(out_img[i], 2)) + diff(extract(out_img[i], 0)))
126
126
 
127
127
 
128
128
 
@@ -146,19 +146,23 @@
146
146
 
147
147
  print("training_data_list[1:]" ,training_data_list[1:])
148
148
 
149
- print(len(training_data_list))
149
+ print("len(training_data_list)" ,len(training_data_list))
150
-
151
- print(len(out_data_list[0]))
150
+
152
-
153
- print(len(out_data_list[0][0]))
151
+ print("len(out_data_list[0])" ,len(out_data_list[0]))
154
-
152
+
155
- print(out_data_list[0][0])
153
+ print("out_data_list[0][0]" ,out_data_list[0][0])
156
-
154
+
157
- print(len(out_data_list[1:]))
155
+ print("out_data_list[1][0]" ,out_data_list[1][0])
156
+
158
-
157
+ print("out_data_list[2][0]" ,out_data_list[2][0])
158
+
159
+ print("out_data_list[0][1]" ,out_data_list[0][1])
160
+
161
+ print("out_data_list[1][1]" ,out_data_list[1][1])
162
+
159
- print(len(out_data_list[0][1]))
163
+ print("len(out_data_list[1:])" ,len(out_data_list[1:]))
160
-
164
+
161
- print(out_data_list[0][1:])
165
+ print("out_data_list[0][1:]" ,out_data_list[0][1:])
162
166
 
163
167
 
164
168
 
@@ -348,8 +352,6 @@
348
352
 
349
353
  plabel = np.argmax(predict)
350
354
 
351
- print("predict" ,predict)
352
-
353
355
  print("plabel" ,plabel)
354
356
 
355
357
  pass
@@ -366,44 +368,62 @@
366
368
 
367
369
  ```出力結果
368
370
 
369
- Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount("/content/drive", force_remount=True).
371
+ Mounted at /content/drive
370
372
 
371
373
  len(out_img) 400
372
374
 
373
- training_data_list [[0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [8, 5, 5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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [20, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 4, 4, 4, 4, 4], [21, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 4, 4, 4, 5, 5
375
+ training_data_list [[0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]
374
376
 
375
377
  中略
376
378
 
377
- , 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [399, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]]
378
-
379
- 400
380
-
381
- 1
382
-
383
- 31
384
-
385
- [0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]
386
-
387
- 0
388
-
389
- ---------------------------------------------------------------------------
390
-
391
- IndexError Traceback (most recent call last)
392
-
393
- <ipython-input-11-b443850dd402> in <module>()
394
-
395
- 74 print(out_data_list[0][0])
396
-
397
- 75 print(len(out_data_list[1:]))
398
-
399
- ---> 76 print(len(out_data_list[0][1]))
400
-
401
- 77 print(out_data_list[0][1:])
402
-
403
- 78
404
-
405
-
406
-
407
- IndexError: list index out of range
379
+ [394, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [395, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [396, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [397, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [398, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [399, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]]
380
+
381
+ len(training_data_list) 400
382
+
383
+ len(out_data_list[0]) 401
384
+
385
+ out_data_list[0][0] 0
386
+
387
+ out_data_list[1][0] 0
388
+
389
+ out_data_list[2][0] 0
390
+
391
+ out_data_list[0][1] [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]
392
+
393
+ out_data_list[1][1] [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]
394
+
395
+ len(out_data_list[1:]) 399
396
+
397
+ out_data_list[0][1:] [[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]
398
+
399
+ 中略
400
+
401
+ [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]]
402
+
403
+ #epoch 0
404
+
405
+ train: 0 / 400
406
+
407
+ 中略
408
+
409
+ #epoch 49
410
+
411
+ train: 0 / 400
412
+
413
+ plabel 148800
414
+
415
+ 中略
416
+
417
+ plabel 148800
418
+
419
+
420
+
421
+ performance: nan
422
+
423
+ /usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:178: RuntimeWarning: invalid value encountered in double_scalars
408
424
 
409
425
  ```
426
+
427
+
428
+
429
+ 何がおかしいかというと、plavelが全て14880なんです、全て同じというのは、同じことの繰り返しになっているわけではないんでしょうか、いずれにせよ、これではプログラムの意味がない・・・。

2

全体を編集しました、回答を受けて。

2021/06/10 09:32

投稿

ques346
ques346

スコア47

test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,9 @@
1
+ ちょっと色々間違えていたので、回答を元に全体を編集しました、
2
+
3
+ しかしどう直せば良いのかいまだに分からずじまいです。
4
+
5
+
6
+
1
7
  ```python
2
8
 
3
9
  from google.colab import drive
@@ -36,6 +42,10 @@
36
42
 
37
43
 
38
44
 
45
+ plt.imshow(img)
46
+
47
+
48
+
39
49
  size = 5
40
50
 
41
51
 
@@ -52,25 +62,17 @@
52
62
 
53
63
 
54
64
 
65
+ print("len(out_img)" ,len(out_img))
66
+
67
+
68
+
69
+ plt.figure(figsize=(400,400))
70
+
71
+
72
+
73
+ for i in range(len(out_img)):
74
+
55
- plt.subplot(17, 6, 1).imshow(out_img[1])
75
+ plt.subplot(17, 60, i+1).imshow(out_img[i])
56
-
57
- plt.subplot(17, 6, 2).imshow(out_img[2])
58
-
59
- plt.subplot(17, 6, 3).imshow(out_img[3])
60
-
61
- plt.subplot(17, 6, 4).imshow(out_img[4])
62
-
63
- plt.subplot(17, 6, 5).imshow(out_img[5])
64
-
65
- plt.subplot(17, 6, 6).imshow(out_img[6])
66
-
67
- plt.subplot(17, 6, 7).imshow(out_img[7])
68
-
69
- plt.subplot(17, 6, 8).imshow(out_img[8])
70
-
71
- plt.subplot(17, 6, 9).imshow(out_img[9])
72
-
73
- plt.subplot(17, 6, 10).imshow(out_img[10])
74
76
 
75
77
 
76
78
 
@@ -116,79 +118,11 @@
116
118
 
117
119
 
118
120
 
119
- #out_data_list = [[]]
121
+ out_data_list = [[]]
120
-
121
-
122
-
122
+
123
- out_data_list = [[]] * 100
123
+ for i in range(len(out_data_list)):
124
-
125
-
126
-
124
+
127
- out_data_list[0].append([0] + diff(extract(out_img[0], 1)) + diff(extract(out_img[0], 2)) + diff(extract(out_img[0], 0)))
125
+ out_data_list[i].append([0] + diff(extract(out_img[i], 1)) + diff(extract(out_img[i], 2)) + diff(extract(out_img[i], 0)))
128
-
129
-
130
-
131
- out_data_list[1].append([0] + diff(extract(out_img[1], 1)) + diff(extract(out_img[1], 2)) + diff(extract(out_img[1], 0)))
132
-
133
-
134
-
135
- out_data_list[2].append([0] + diff(extract(out_img[2], 1)) + diff(extract(out_img[2], 2)) + diff(extract(out_img[2], 0)))
136
-
137
-
138
-
139
- out_data_list[3].append([0] + diff(extract(out_img[3], 1)) + diff(extract(out_img[3], 2)) + diff(extract(out_img[3], 0)))
140
-
141
-
142
-
143
- out_data_list[4].append([0] + diff(extract(out_img[4], 1)) + diff(extract(out_img[4], 2)) + diff(extract(out_img[4], 0)))
144
-
145
-
146
-
147
- out_data_list[5].append([0] + diff(extract(out_img[5], 1)) + diff(extract(out_img[5], 2)) + diff(extract(out_img[5], 0)))
148
-
149
-
150
-
151
- out_data_list[6].append([0] + diff(extract(out_img[6], 1)) + diff(extract(out_img[6], 2)) + diff(extract(out_img[6], 0)))
152
-
153
-
154
-
155
- out_data_list[7].append([0] + diff(extract(out_img[7], 1)) + diff(extract(out_img[7], 2)) + diff(extract(out_img[7], 0)))
156
-
157
-
158
-
159
- out_data_list[8].append([0] + diff(extract(out_img[8], 1)) + diff(extract(out_img[8], 2)) + diff(extract(out_img[8], 0)))
160
-
161
-
162
-
163
- out_data_list[9].append([0] + diff(extract(out_img[9], 1)) + diff(extract(out_img[9], 2)) + diff(extract(out_img[9], 0)))
164
-
165
-
166
-
167
- out_data_list[10].append([0] + diff(extract(out_img[10], 1)) + diff(extract(out_img[10], 2)) + diff(extract(out_img[10], 0)))
168
-
169
-
170
-
171
- out_data_list[11].append([0] + diff(extract(out_img[11], 1)) + diff(extract(out_img[11], 2)) + diff(extract(out_img[11], 0)))
172
-
173
-
174
-
175
- out_data_list[12].append([0] + diff(extract(out_img[12], 1)) + diff(extract(out_img[12], 2)) + diff(extract(out_img[12], 0)))
176
-
177
-
178
-
179
- out_data_list[13].append([0] + diff(extract(out_img[13], 1)) + diff(extract(out_img[13], 2)) + diff(extract(out_img[13], 0)))
180
-
181
-
182
-
183
- out_data_list[14].append([0] + diff(extract(out_img[14], 1)) + diff(extract(out_img[14], 2)) + diff(extract(out_img[14], 0)))
184
-
185
-
186
-
187
- out_data_list[15].append([0] + diff(extract(out_img[15], 1)) + diff(extract(out_img[15], 2)) + diff(extract(out_img[15], 0)))
188
-
189
-
190
-
191
- print(out_data_list[15])
192
126
 
193
127
 
194
128
 
@@ -214,11 +148,17 @@
214
148
 
215
149
  print(len(training_data_list))
216
150
 
151
+ print(len(out_data_list[0]))
152
+
153
+ print(len(out_data_list[0][0]))
154
+
155
+ print(out_data_list[0][0])
156
+
157
+ print(len(out_data_list[1:]))
158
+
159
+ print(len(out_data_list[0][1]))
160
+
217
- print(out_data_list[0][1:])
161
+ print(out_data_list[0][1:])
218
-
219
- print(out_data_list[1][1:])
220
-
221
- print(out_data_list[2][1:])
222
162
 
223
163
 
224
164
 
@@ -424,130 +364,46 @@
424
364
 
425
365
 
426
366
 
427
- とすると、出力結果は、
367
+ ```出力結果
428
368
 
429
369
  Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount("/content/drive", force_remount=True).
430
370
 
431
- [[0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],
371
+ len(out_img) 400
372
+
373
+ training_data_list [[0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [8, 5, 5, 5, 5, 5,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [20, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 4, 4, 4, 4, 4], [21, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 4, 4, 4, 5, 5
432
374
 
433
375
  中略
434
376
 
435
- 5, 5, 5, 5, 5, 5, 5], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
436
-
437
- #epoch 0
438
-
439
- train: 0 / 400
440
-
441
- #epoch 1
442
-
443
- train: 0 / 400
444
-
445
- #epoch 2
446
-
447
- train: 0 / 400
448
-
449
- 中略
450
-
451
- #epoch 48
452
-
453
- train: 0 / 400
454
-
455
- #epoch 49
456
-
457
- train: 0 / 400
377
+ , 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [399, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]]
378
+
379
+ 400
380
+
381
+ 1
382
+
383
+ 31
384
+
385
+ [0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]
386
+
387
+ 0
458
388
 
459
389
  ---------------------------------------------------------------------------
460
390
 
461
- ValueError Traceback (most recent call last)
391
+ IndexError Traceback (most recent call last)
462
-
392
+
463
- <ipython-input-18-acd557a26dee> in <module>()
393
+ <ipython-input-11-b443850dd402> in <module>()
394
+
464
-
395
+ 74 print(out_data_list[0][0])
396
+
397
+ 75 print(len(out_data_list[1:]))
398
+
465
- 201 for i in range(len(out_data_list)):
399
+ ---> 76 print(len(out_data_list[0][1]))
466
-
467
- 202 idata = (np.array(out_data_list[i][1:]) / 255.0 * 0.99) + 0.01
400
+
468
-
469
- --> 203 predict = nn.feedforward(idata)
470
-
471
- 204 plabel = np.argmax(predict)
472
-
473
- 205 print("predict" ,predict)
474
-
475
-
476
-
477
- <ipython-input-18-acd557a26dee> in feedforward(self, idata)
478
-
479
- 161
480
-
481
- 162 # 隠れ層
482
-
483
- --> 163 x_h = np.dot(self.w_ih, o_i)
484
-
485
- 164 o_h = self.af(x_h)
486
-
487
- 165
488
-
489
-
490
-
491
- <__array_function__ internals> in dot(*args, **kwargs)
492
-
493
-
494
-
495
- ValueError: shapes (100,30) and (31,15) not aligned: 30 (dim 1) != 31 (dim 0)
496
-
497
-
498
-
499
- というエラーが出てしまいました、今度はidata?をどう直せば良いでしょうか・・・。
500
-
501
-
502
-
503
- print(out_data)の上に
401
+ 77 print(out_data_list[0][1:])
504
-
402
+
505
- ```python
403
+ 78
506
-
507
- print("len(out_data_list[0]" ,len(out_data_list[0]))
404
+
508
-
509
- print("len(out_data_list[0][0]" ,len(out_data_list[0][0]))
405
+
510
-
406
+
511
- print("out_data_list[0][0]" ,out_data_list[0][0])
407
+ IndexError: list index out of range
512
-
513
- print("out_data_list[0][1]" ,out_data_list[0][1])
514
-
515
- print("out_data_list[0][1:]" ,out_data_list[0][1:])
516
408
 
517
409
  ```
518
-
519
-
520
-
521
- を入れると、
522
-
523
-
524
-
525
- len(out_data_list[0] 1
526
-
527
- len(out_data_list[0][0] 31
528
-
529
- out_data_list[0][0] [0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]
530
-
531
- ---------------------------------------------------------------------------
532
-
533
- IndexError Traceback (most recent call last)
534
-
535
- <ipython-input-6-11ba74eedc3b> in <module>()
536
-
537
- 74 print("len(out_data_list[0][0]" ,len(out_data_list[0][0]))
538
-
539
- 75 print("out_data_list[0][0]" ,out_data_list[0][0])
540
-
541
- ---> 76 print("out_data_list[0][1]" ,out_data_list[0][1])
542
-
543
- 77 print("out_data_list[0][1:]" ,out_data_list[0][1:])
544
-
545
- 78
546
-
547
-
548
-
549
- IndexError: list index out of range
550
-
551
-
552
-
553
- このようなエラーが出ました、しかしエラーが読み解けません。

1

回答を受けて、追記し、結果を載せました。

2021/06/10 06:56

投稿

ques346
ques346

スコア47

test CHANGED
File without changes
test CHANGED
@@ -428,13 +428,11 @@
428
428
 
429
429
  Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount("/content/drive", force_remount=True).
430
430
 
431
- [[0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,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0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
438
436
 
439
437
  #epoch 0
440
438
 
@@ -499,3 +497,57 @@
499
497
 
500
498
 
501
499
  というエラーが出てしまいました、今度はidata?をどう直せば良いでしょうか・・・。
500
+
501
+
502
+
503
+ print(out_data)の上に
504
+
505
+ ```python
506
+
507
+ print("len(out_data_list[0]" ,len(out_data_list[0]))
508
+
509
+ print("len(out_data_list[0][0]" ,len(out_data_list[0][0]))
510
+
511
+ print("out_data_list[0][0]" ,out_data_list[0][0])
512
+
513
+ print("out_data_list[0][1]" ,out_data_list[0][1])
514
+
515
+ print("out_data_list[0][1:]" ,out_data_list[0][1:])
516
+
517
+ ```
518
+
519
+
520
+
521
+ を入れると、
522
+
523
+
524
+
525
+ len(out_data_list[0] 1
526
+
527
+ len(out_data_list[0][0] 31
528
+
529
+ out_data_list[0][0] [0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]
530
+
531
+ ---------------------------------------------------------------------------
532
+
533
+ IndexError Traceback (most recent call last)
534
+
535
+ <ipython-input-6-11ba74eedc3b> in <module>()
536
+
537
+ 74 print("len(out_data_list[0][0]" ,len(out_data_list[0][0]))
538
+
539
+ 75 print("out_data_list[0][0]" ,out_data_list[0][0])
540
+
541
+ ---> 76 print("out_data_list[0][1]" ,out_data_list[0][1])
542
+
543
+ 77 print("out_data_list[0][1:]" ,out_data_list[0][1:])
544
+
545
+ 78
546
+
547
+
548
+
549
+ IndexError: list index out of range
550
+
551
+
552
+
553
+ このようなエラーが出ました、しかしエラーが読み解けません。