質問編集履歴
1
より詳しいエラーの内容
test
CHANGED
File without changes
|
test
CHANGED
@@ -27,3 +27,69 @@
|
|
27
27
|
学習を積み重ねて,ベストモデルで予測をしようとしたところです。
|
28
28
|
|
29
29
|
よろしくお願いします。
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
詳しい内容は以下の通りです。
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
「PyTorchのLSTMで時系列データ予測」はこちらです。
|
38
|
+
|
39
|
+
https://qiita.com/THERE2/items/3c13164c1c82c1dcf4b7
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
エラーの内容は
|
44
|
+
|
45
|
+
RuntimeError Traceback (most recent call last)
|
46
|
+
|
47
|
+
<ipython-input-10-661eca1a7b01> in <module>()
|
48
|
+
|
49
|
+
128 with torch.no_grad():
|
50
|
+
|
51
|
+
129 feats_test = prep_feature_data(np.arange(time_steps, X_test.size(0)), time_steps, X_test, feature_num, device)
|
52
|
+
|
53
|
+
--> 130 val_scores = model(feats_test)
|
54
|
+
|
55
|
+
131 tmp_scores = val_scores.view(-1).to('cpu').numpy()
|
56
|
+
|
57
|
+
132 bi_scores = np.round(tmp_scores)
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
1 frames
|
62
|
+
|
63
|
+
/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
|
64
|
+
|
65
|
+
1100 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
|
66
|
+
|
67
|
+
1101 or _global_forward_hooks or _global_forward_pre_hooks):
|
68
|
+
|
69
|
+
-> 1102 return forward_call(*input, **kwargs)
|
70
|
+
|
71
|
+
1103 # Do not call functions when jit is used
|
72
|
+
|
73
|
+
1104 full_backward_hooks, non_full_backward_hooks = [], []
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
<ipython-input-10-661eca1a7b01> in forward(self, X_input)
|
78
|
+
|
79
|
+
72 _, lstm_out = self.lstm(X_input)
|
80
|
+
|
81
|
+
73 # LSTMの最終出力のみを利用する。
|
82
|
+
|
83
|
+
---> 74 linear_out = self.dense(lstm_out[0].view(X_input.size(0), -1))
|
84
|
+
|
85
|
+
75 return torch.sigmoid(linear_out)
|
86
|
+
|
87
|
+
76
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
RuntimeError: cannot reshape tensor of 0 elements into shape [0, -1] because the unspecified dimension size -1 can be any value and is ambiguous
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
です。
|