首页 > 解决方案 > 在 R 中运行 Keras 顺序模型

问题描述

我正在创建一个神经网络模型,我想keras_sequential_model()在 R Studio 中运行。我已经使用命令安装了张量流install_tensorflow()。但是,当我运行keras_sequential_model()构建模型时,它会返回一个全局环境,而不是我可以编译的模型。我在控制台中打印了以下内容:

2021-06-02 10:26:06.287327: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-06-02 10:26:06.291491: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2021-06-02 10:26:06.292624: W tensorflow/stream_executor/cuda/cuda_driver.cc:326] failed call to cuInit: UNKNOWN ERROR (303)
2021-06-02 10:26:06.293598: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: iFeanyiPC
2021-06-02 10:26:06.294593: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: iFeanyiPC
2021-06-02 10:26:06.298435: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-06-02 10:26:06.302191: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set

如何解释这一点以及我做错了什么?

标签: pythonrtensorflow

解决方案


老实说,我在 ML 任务中使用了 python,我建议你尝试一下。至于您的问题,我建议您查看此示例https://tensorflow.rstudio.com/guide/keras/,因为逐步解释了如何执行此操作。此外,尝试使用 google colab,因为这可能是您的桌面问题,而不是您的代码。


推荐阅读