質問編集履歴
5
結果行変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -424,31 +424,31 @@
|
|
424
424
|
|
425
425
|
model.fit(train_images, train_labels, epochs=5)
|
426
426
|
|
427
|
-
File "C:\Users\
|
427
|
+
File "C:\Users\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\keras\engine\training.py", line 1100, in fit
|
428
428
|
|
429
429
|
tmp_logs = self.train_function(iterator)
|
430
430
|
|
431
|
-
File "C:\Users\
|
431
|
+
File "C:\Users\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\def_function.py", line 828, in __call__
|
432
432
|
|
433
433
|
result = self._call(*args, **kwds)
|
434
434
|
|
435
|
-
File "C:\Users\
|
435
|
+
File "C:\Users\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\def_function.py", line 888, in _call
|
436
436
|
|
437
437
|
return self._stateless_fn(*args, **kwds)
|
438
438
|
|
439
|
-
File "C:\Users\
|
439
|
+
File "C:\Users\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\function.py", line 2942, in __call__
|
440
440
|
|
441
441
|
return graph_function._call_flat(
|
442
442
|
|
443
|
-
File "C:\Users\
|
443
|
+
File "C:\Users\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\function.py", line 1918, in _call_flat
|
444
444
|
|
445
445
|
return self._build_call_outputs(self._inference_function.call(
|
446
446
|
|
447
|
-
File "C:\Users\
|
447
|
+
File "C:\Users\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\function.py", line 555, in call
|
448
448
|
|
449
449
|
outputs = execute.execute(
|
450
450
|
|
451
|
-
File "C:\Users\
|
451
|
+
File "C:\Users\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\execute.py", line 59, in quick_execute
|
452
452
|
|
453
453
|
tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
|
454
454
|
|
4
回答に対して試した結果を更新
test
CHANGED
File without changes
|
test
CHANGED
@@ -252,6 +252,18 @@
|
|
252
252
|
|
253
253
|
```python
|
254
254
|
|
255
|
+
# TensorFlow と tf.keras のインポート
|
256
|
+
|
257
|
+
import tensorflow as tf
|
258
|
+
|
259
|
+
from tensorflow import keras
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
# ヘルパーライブラリのインポート
|
264
|
+
|
265
|
+
import numpy as np
|
266
|
+
|
255
267
|
import matplotlib.pyplot as plt
|
256
268
|
|
257
269
|
|
@@ -268,7 +280,7 @@
|
|
268
280
|
|
269
281
|
import image_dataset
|
270
282
|
|
271
|
-
train_images ,train_labels, test_images ,test_labels = image_dataset.make('C:dataset',img_size = 32, train_num=10000 , test_num =1000)
|
283
|
+
train_images ,train_labels, test_images ,test_labels = image_dataset.make('C:/Users/cv/dataset',img_size = 32, train_num=10000 , test_num =1000)
|
272
284
|
|
273
285
|
|
274
286
|
|
@@ -276,6 +288,10 @@
|
|
276
288
|
|
277
289
|
|
278
290
|
|
291
|
+
print(train_images.shape, train_labels.shape)
|
292
|
+
|
293
|
+
|
294
|
+
|
279
295
|
#plt.figure()
|
280
296
|
|
281
297
|
#plt.imshow(train_images[0], cmap='gray')
|
@@ -322,8 +338,6 @@
|
|
322
338
|
|
323
339
|
model = keras.Sequential([
|
324
340
|
|
325
|
-
keras.layers.Flatten(input_shape=(28, 28)),
|
326
|
-
|
327
341
|
keras.layers.Dense(128, activation='relu'),
|
328
342
|
|
329
343
|
keras.layers.Dense(10, activation='softmax')
|
@@ -364,83 +378,95 @@
|
|
364
378
|
|
365
379
|
```
|
366
380
|
|
381
|
+
Flatten実行の行を消して実行した結果
|
382
|
+
|
367
|
-
```
|
383
|
+
```
|
368
|
-
|
369
|
-
|
384
|
+
|
370
|
-
|
371
|
-
2021-02-1
|
385
|
+
2021-02-17 10:05:53.420778: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not f
|
372
386
|
|
373
387
|
ound
|
374
388
|
|
375
|
-
2021-02-1
|
389
|
+
2021-02-17 10:05:53.428672: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
|
390
|
+
|
391
|
+
2.4.1
|
392
|
+
|
393
|
+
0read complete ,1 pictures exit
|
376
394
|
|
377
395
|
~中略~
|
378
396
|
|
397
|
+
(10, 3072) (10, 10)
|
398
|
+
|
399
|
+
2021-02-17 10:05:59.694157: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
|
400
|
+
|
379
|
-
W
|
401
|
+
2021-02-17 10:05:59.706703: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
|
402
|
+
|
380
|
-
|
403
|
+
2021-02-17 10:05:59.718986: W tensorflow/stream_executor/cuda/cuda_driver.cc:326] failed call to cuInit: UNKNOWN ERROR (303)
|
404
|
+
|
405
|
+
2021-02-17 10:05:59.799102: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: CVPC-0164
|
406
|
+
|
407
|
+
2021-02-17 10:05:59.806406: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: CVPC-0164
|
408
|
+
|
381
|
-
|
409
|
+
2021-02-17 10:05:59.811840: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use t
|
410
|
+
|
411
|
+
he following CPU instructions in performance-critical operations: AVX2
|
412
|
+
|
413
|
+
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
|
414
|
+
|
415
|
+
2021-02-17 10:05:59.820411: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
|
416
|
+
|
417
|
+
2021-02-17 10:06:00.102449: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:116] None of the MLIR optimization passes are enabled (registered 2)
|
418
|
+
|
419
|
+
Epoch 1/5
|
382
420
|
|
383
421
|
Traceback (most recent call last):
|
384
422
|
|
385
|
-
File "cnn_
|
423
|
+
File "cnn_image.py", line 53, in <module>
|
386
424
|
|
387
425
|
model.fit(train_images, train_labels, epochs=5)
|
388
426
|
|
389
|
-
File "C:\Users\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\keras\engine\training.py", line 1100, in fit
|
427
|
+
File "C:\Users\cv\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\keras\engine\training.py", line 1100, in fit
|
390
428
|
|
391
429
|
tmp_logs = self.train_function(iterator)
|
392
430
|
|
393
|
-
File "C:\Users\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\def_function.py", line 828, in __call__
|
431
|
+
File "C:\Users\cv\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\def_function.py", line 828, in __call__
|
394
432
|
|
395
433
|
result = self._call(*args, **kwds)
|
396
434
|
|
397
|
-
File "C:\Users\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\def_function.py", line 8
|
435
|
+
File "C:\Users\cv\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\def_function.py", line 888, in _call
|
436
|
+
|
398
|
-
|
437
|
+
return self._stateless_fn(*args, **kwds)
|
438
|
+
|
439
|
+
File "C:\Users\cv\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\function.py", line 2942, in __call__
|
440
|
+
|
441
|
+
return graph_function._call_flat(
|
442
|
+
|
443
|
+
File "C:\Users\cv\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\function.py", line 1918, in _call_flat
|
444
|
+
|
399
|
-
self._i
|
445
|
+
return self._build_call_outputs(self._inference_function.call(
|
400
|
-
|
446
|
+
|
401
|
-
File "C:\Users\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\
|
447
|
+
File "C:\Users\cv\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\function.py", line 555, in call
|
402
|
-
|
403
|
-
|
448
|
+
|
404
|
-
|
405
|
-
File "C:\Users\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\function.py", line 2969, in _get_concrete_function_internal_garbage_collected
|
406
|
-
|
407
|
-
graph_function, _ = self._maybe_define_function(args, kwargs)
|
408
|
-
|
409
|
-
File "C:\Users\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\function.py", line 3361, in _maybe_define_function
|
410
|
-
|
411
|
-
graph_function = self._create_graph_function(args, kwargs)
|
412
|
-
|
413
|
-
File "C:\Users\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\function.py", line 3196, in _create_graph_function
|
414
|
-
|
415
|
-
func_graph_module.func_graph_from_py_func(
|
416
|
-
|
417
|
-
File "C:\Users\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\framework\func_graph.py", line 990, in func_graph_from_py_func
|
418
|
-
|
419
|
-
|
449
|
+
outputs = execute.execute(
|
420
|
-
|
450
|
+
|
421
|
-
File "C:\Users\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\
|
451
|
+
File "C:\Users\cv\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\eager\execute.py", line 59, in quick_execute
|
422
|
-
|
423
|
-
|
452
|
+
|
424
|
-
|
425
|
-
File "C:\Users\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\framework\func_graph.py", line 977, in wrapper
|
426
|
-
|
427
|
-
raise e.ag_error_metadata.to_exception(e)
|
428
|
-
|
429
|
-
ValueError: in user code:
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
453
|
+
tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
|
434
|
-
|
435
|
-
|
454
|
+
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
455
|
+
tensorflow.python.framework.errors_impl.InvalidArgumentError: logits and labels must have the same first dimension, got logits shape [10,10] and labels shape [100]
|
456
|
+
|
440
|
-
|
457
|
+
[[node sparse_categorical_crossentropy/SparseSoftmaxCrossEntropyWithLogits/SparseSoftmaxCrossEntropyWithLogits (defined at cnn_image.py:53) ]] [Op:__inference_train_
|
458
|
+
|
441
|
-
|
459
|
+
function_528]
|
460
|
+
|
461
|
+
|
462
|
+
|
442
|
-
|
463
|
+
Function call stack:
|
464
|
+
|
465
|
+
train_function
|
466
|
+
|
467
|
+
|
468
|
+
|
443
|
-
PS C:\Users>
|
469
|
+
PS C:\Users\cv>
|
444
470
|
|
445
471
|
```
|
446
472
|
|
3
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -444,7 +444,7 @@
|
|
444
444
|
|
445
445
|
```
|
446
446
|
|
447
|
-
print(train_images.shape, train_labels.shape)
|
447
|
+
print(train_images.shape, train_labels.shape)の結果
|
448
448
|
|
449
449
|
```
|
450
450
|
|
2
情報追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -444,9 +444,9 @@
|
|
444
444
|
|
445
445
|
```
|
446
446
|
|
447
|
-
|
448
|
-
|
449
|
-
|
447
|
+
print(train_images.shape, train_labels.shape)`の結果
|
448
|
+
|
449
|
+
```
|
450
450
|
|
451
451
|
(10, 2352) (10, 10)
|
452
452
|
|
1
print(train_images.shape, train_labels.shape)`の結果を追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -444,6 +444,14 @@
|
|
444
444
|
|
445
445
|
```
|
446
446
|
|
447
|
+
|
448
|
+
|
449
|
+
```print(train_images.shape, train_labels.shape)`の結果
|
450
|
+
|
451
|
+
(10, 2352) (10, 10)
|
452
|
+
|
453
|
+
```
|
454
|
+
|
447
455
|
python3.7
|
448
456
|
|
449
457
|
Tensorflow2.4.1
|