質問編集履歴
5
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -40,7 +40,9 @@
|
|
40
40
|
|
41
41
|
必要があればコードやスペックなども記述しますので、宜しくお願い致します。
|
42
42
|
|
43
|
-
|
43
|
+
以下、nvidia-smiを実行。
|
44
|
+
|
45
|
+
GPU-Util = 0%なのが気がかりです。
|
44
46
|
|
45
47
|
|
46
48
|
|
4
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -81,3 +81,213 @@
|
|
81
81
|
|
82
82
|
|
83
83
|
```
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
以下、上手く実行された例
|
88
|
+
|
89
|
+
```ここに言語を入力
|
90
|
+
|
91
|
+
# -*- coding: utf-8 -*-
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
import tensorflow as tf
|
96
|
+
|
97
|
+
import numpy as np
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
# Create 100 phony x, y data points in NumPy, y = x * 0.1 + 0.3
|
102
|
+
|
103
|
+
x_data = np.random.rand(1000,100).astype(np.float32)
|
104
|
+
|
105
|
+
y_data = x_data * 0.1 + 0.3
|
106
|
+
|
107
|
+
print(x_data)
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
X = tf.placeholder(dtype = tf.float32, shape = [None, x_data.shape[1]])
|
112
|
+
|
113
|
+
Y = tf.placeholder(dtype = tf.float32, shape = [None, y_data.shape[1]])
|
114
|
+
|
115
|
+
# Try to find values for W and b that compute y_data = W * x_data + b
|
116
|
+
|
117
|
+
# (We know that W should be 0.1 and b 0.3, but TensorFlow will
|
118
|
+
|
119
|
+
# figure that out for us.)
|
120
|
+
|
121
|
+
W = tf.Variable(tf.random_uniform([100,100], -1.0, 1.0))
|
122
|
+
|
123
|
+
b = tf.Variable(tf.zeros([1]))
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
######相違点#######
|
128
|
+
|
129
|
+
y = W * X + b
|
130
|
+
|
131
|
+
#y=tf.matmul(W,X)+b
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
# Minimize the mean squared errors.
|
136
|
+
|
137
|
+
loss = tf.reduce_mean(tf.square(y -Y))
|
138
|
+
|
139
|
+
optimizer = tf.train.GradientDescentOptimizer(0.5)
|
140
|
+
|
141
|
+
train = optimizer.minimize(loss)
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
# Before starting, initialize the variables. We will 'run' this first.
|
146
|
+
|
147
|
+
init = tf.global_variables_initializer()
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
# Launch the graph.
|
152
|
+
|
153
|
+
sess = tf.Session()
|
154
|
+
|
155
|
+
sess.run(init)
|
156
|
+
|
157
|
+
#print(x_data)
|
158
|
+
|
159
|
+
#print(y_data)
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
# Fit the line.
|
164
|
+
|
165
|
+
for step in range(201):
|
166
|
+
|
167
|
+
#sess.run(train)
|
168
|
+
|
169
|
+
sess.run(train,feed_dict={X:x_data[0:100],Y:y_data[0:100]})
|
170
|
+
|
171
|
+
if step % 20 == 0:
|
172
|
+
|
173
|
+
print(step, sess.run(W), sess.run(b))
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
# Learns best fit is W: [0.1], b: [0.3]
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
# Close the Session when we're done.
|
182
|
+
|
183
|
+
sess.close()
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
```
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
以下、上手くいかずフリーズした例
|
192
|
+
|
193
|
+
```ここに言語を入力
|
194
|
+
|
195
|
+
# -*- coding: utf-8 -*-
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
import tensorflow as tf
|
200
|
+
|
201
|
+
import numpy as np
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
# Create 100 phony x, y data points in NumPy, y = x * 0.1 + 0.3
|
206
|
+
|
207
|
+
x_data = np.random.rand(1000,100).astype(np.float32)
|
208
|
+
|
209
|
+
y_data = x_data * 0.1 + 0.3
|
210
|
+
|
211
|
+
print(x_data)
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
X = tf.placeholder(dtype = tf.float32, shape = [None, x_data.shape[1]])
|
216
|
+
|
217
|
+
Y = tf.placeholder(dtype = tf.float32, shape = [None, y_data.shape[1]])
|
218
|
+
|
219
|
+
# Try to find values for W and b that compute y_data = W * x_data + b
|
220
|
+
|
221
|
+
# (We know that W should be 0.1 and b 0.3, but TensorFlow will
|
222
|
+
|
223
|
+
# figure that out for us.)
|
224
|
+
|
225
|
+
W = tf.Variable(tf.random_uniform([100,100], -1.0, 1.0))
|
226
|
+
|
227
|
+
b = tf.Variable(tf.zeros([1]))
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
######相違点#######
|
232
|
+
|
233
|
+
#y = W * X + b
|
234
|
+
|
235
|
+
y=tf.matmul(W,X)+b
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
# Minimize the mean squared errors.
|
242
|
+
|
243
|
+
loss = tf.reduce_mean(tf.square(y -Y))
|
244
|
+
|
245
|
+
optimizer = tf.train.GradientDescentOptimizer(0.5)
|
246
|
+
|
247
|
+
train = optimizer.minimize(loss)
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
# Before starting, initialize the variables. We will 'run' this first.
|
252
|
+
|
253
|
+
init = tf.global_variables_initializer()
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
# Launch the graph.
|
258
|
+
|
259
|
+
sess = tf.Session()
|
260
|
+
|
261
|
+
sess.run(init)
|
262
|
+
|
263
|
+
#print(x_data)
|
264
|
+
|
265
|
+
#print(y_data)
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
# Fit the line.
|
270
|
+
|
271
|
+
for step in range(201):
|
272
|
+
|
273
|
+
#sess.run(train)
|
274
|
+
|
275
|
+
sess.run(train,feed_dict={X:x_data[0:100],Y:y_data[0:100]})
|
276
|
+
|
277
|
+
if step % 20 == 0:
|
278
|
+
|
279
|
+
print(step, sess.run(W), sess.run(b))
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
# Learns best fit is W: [0.1], b: [0.3]
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
# Close the Session when we're done.
|
288
|
+
|
289
|
+
sess.close()
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
```
|
3
nvidia-smiの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -39,3 +39,45 @@
|
|
39
39
|
ご意見よろしくお願い致します。
|
40
40
|
|
41
41
|
必要があればコードやスペックなども記述しますので、宜しくお願い致します。
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
```
|
48
|
+
|
49
|
+
+-----------------------------------------------------------------------------+
|
50
|
+
|
51
|
+
| NVIDIA-SMI 384.111 Driver Version: 384.111 |
|
52
|
+
|
53
|
+
|-------------------------------+----------------------+----------------------+
|
54
|
+
|
55
|
+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
|
56
|
+
|
57
|
+
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|
58
|
+
|
59
|
+
|===============================+======================+======================|
|
60
|
+
|
61
|
+
| 0 GeForce GTX TIT... Off | 00000000:02:00.0 Off | N/A |
|
62
|
+
|
63
|
+
| 22% 48C P2 67W / 250W | 11645MiB / 12205MiB | 0% Default |
|
64
|
+
|
65
|
+
+-------------------------------+----------------------+----------------------+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
+-----------------------------------------------------------------------------+
|
70
|
+
|
71
|
+
| Processes: GPU Memory |
|
72
|
+
|
73
|
+
| GPU PID Type Process name Usage |
|
74
|
+
|
75
|
+
|=============================================================================|
|
76
|
+
|
77
|
+
| 0 7449 C python 11634MiB |
|
78
|
+
|
79
|
+
+-----------------------------------------------------------------------------+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
```
|
2
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -35,3 +35,7 @@
|
|
35
35
|
|
36
36
|
|
37
37
|
feed_dictを使うと停止してしまうみたいなのですが、どうすれば改善できると思いますか?
|
38
|
+
|
39
|
+
ご意見よろしくお願い致します。
|
40
|
+
|
41
|
+
必要があればコードやスペックなども記述しますので、宜しくお願い致します。
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
### 前提・実現したいこと
|
2
2
|
|
3
3
|
|
4
|
-
|
5
|
-
ここに質問の内容を詳しく書いてください。
|
6
4
|
|
7
5
|
tensorflowを使ってGPUで学習をしようとしています。
|
8
6
|
|