質問編集履歴
1
プログラムの改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -183,3 +183,22 @@
|
|
183
183
|
9998 0.33641746854182086 0.30564784053156147 1.1340349912643433
|
184
184
|
9999 0.33641746854182086 0.30564784053156147 1.1340349912643433
|
185
185
|
10000 0.33641746854182086 0.30564784053156147 1.1340349912643433
|
186
|
+
|
187
|
+
**追加**
|
188
|
+
```Python
|
189
|
+
train_x=np.array([])
|
190
|
+
for i in range(len(x_train)):
|
191
|
+
train_x = np.append(train_x,[ x_train[i] , y_train[i] ] )
|
192
|
+
|
193
|
+
train_x=train_x.reshape(len(x_train),2).astype(float)
|
194
|
+
train_x = torch.tensor(train_x,dtype=float,requires_grad=True)#Tensor型に変換,微分可能にする
|
195
|
+
train_x=train_x.to(torch.float)
|
196
|
+
|
197
|
+
test_x=np.array([])
|
198
|
+
for i in range(len(x_test)):
|
199
|
+
test_x = np.append(test_x,[ x_test[i] , y_test[i] ] )
|
200
|
+
|
201
|
+
test_x=test_x.reshape(len(x_test),2).astype(float)
|
202
|
+
test_x = torch.tensor(test_x,dtype=float,requires_grad=True)#Tensor型に変換,微分可能にする
|
203
|
+
test_x=test_x.to(torch.float)
|
204
|
+
```
|