質問編集履歴

1

fwd内の過程における配列の状態を記入しました。

2018/03/05 06:18

投稿

futashige
futashige

スコア28

test CHANGED
File without changes
test CHANGED
@@ -82,6 +82,10 @@
82
82
 
83
83
  h = F.relu(self.l4(h))
84
84
 
85
+ print(h.shape)
86
+
87
+ print(h.dtype)
88
+
85
89
 
86
90
 
87
91
  h_time = self.b1_time(F.relu(self.l1_time(x_time)))
@@ -89,6 +93,10 @@
89
93
  h_time = self.b2_time(F.relu(self.l2_time(h_time)))
90
94
 
91
95
  h_time = F.relu(self.l3_time(h_time))
96
+
97
+ print(h_time.shape)
98
+
99
+ print(h_time.dtype)
92
100
 
93
101
 
94
102
 
@@ -98,9 +106,15 @@
98
106
 
99
107
  h_weather = F.relu(self.l3_weather(h_weather))
100
108
 
109
+ print(h_weather.shape)
110
+
111
+ print(h_weather.dtype)
112
+
101
113
 
102
114
 
103
115
  h_ratio = np.hstack((h,h_time,h_weather))
116
+
117
+ print(h_ratio.shape)
104
118
 
105
119
  print(h_ratio.dtype)
106
120
 
@@ -114,7 +128,7 @@
114
128
 
115
129
 
116
130
 
117
- 上記のモデルで訓練を行うと、以下のようなエラーが出しまいます。
131
+ 上記のモデルで訓練を行うと、以下のようなエラーが出しまいます。
118
132
 
119
133
  ```python
120
134
 
@@ -144,6 +158,36 @@
144
158
 
145
159
  ```
146
160
 
161
+
162
+
163
+ この際、print文による出力で、以下のようになっていることが確認できました。
164
+
165
+ ```python
166
+
167
+ x_train.shape:(148320, 367)
168
+
169
+ y_train.shape:(148320, 6)
170
+
171
+
172
+
173
+ h.shape:(128, 8)
174
+
175
+ h.dtype:float32
176
+
177
+ h_time.shape:(128, 1)
178
+
179
+ h_time.dtype:float32
180
+
181
+ h_weather.shape:(128, 1)
182
+
183
+ h_weather.dtype:float32
184
+
185
+ h_ratio.shape:(128, 10)
186
+
187
+ h_ratio.dtype:object
188
+
189
+ ```
190
+
147
191
  どうやら、np.hstackにおいて、配列の型がfloat32からobjectとなってしまっていることが原因のようなのですが、なぜこのようなことが起きてしまうのかがわかりません。
148
192
 
149
193
  どのようにすれば解決することができるのでしょうか?