重点在于import tensorflow.keras (可行)
我在 cmd 和notebook都试了
cmd的: ^
SyntaxError: invalid syntax
>>> import tensorflow as tf
2022-04-12 15:12:12.866276: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-04-12 15:12:12.866432: 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.
>>>
>>>
>>> a = tf.random.uniform([4,10])
2022-04-12 15:12:35.790241: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2022-04-12 15:12:35.790398: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303)
2022-04-12 15:12:35.794124: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: LAPTOP-RS017NRJ
2022-04-12 15:12:35.794342: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: LAPTOP-RS017NRJ
2022-04-12 15:12:35.795301: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
>>> print(a)
tf.Tensor(
[[0.8562763 0.74294853 0.3382907 0.06466854 0.1204735 0.52903223
0.85028434 0.64586246 0.1983546 0.07855964]
[0.43987226 0.3635075 0.52682006 0.28708458 0.8067572 0.15162098
0.8284776 0.62292194 0.54997706 0.50583315]
[0.34328866 0.1397022 0.8850664 0.9506463 0.7170223 0.13799334
0.17858255 0.7092109 0.86810756 0.9444325 ]
[0.97939897 0.5265962 0.97248435 0.70333874 0.8734523 0.3986025
0.01936245 0.07984626 0.59270334 0.48528957]], shape=(4,
ModuleNotFoundError: No module named ‘keras.api‘解决
最新推荐文章于 2024-05-28 02:16:16 发布