已解决 I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with on

已解决WARNING:tensorflow:From <stdin>1: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.config.list_physical_devices(‘GPU’)~ instead.
2023-03-31 16:58:07.971004: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDMN) 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









Error report



A friend in the fan group ran into a problem and came to private message me, wanting to use tensorflow, but an error occurred (at that time, his heart was cold for a moment, he came to me for help, and then helped him solve it smoothly, and record it by the way I hope it can help more friends who encounter this bug and cannot solve it), the error code is as follows:

insert image description here

A screenshot of the content of the error message is as follows :


insert image description here

WARNING:tensorflow:From `<stdin>`1: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.config.list_physical_devices('GPU')~ instead.
2023-03-31 16:58:07.971004: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDMN) 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
False



error translation



The translation of the error message content is as follows :

WARNING: tensorflow:From(stdin)1:is_gpu_available(From tensorflow.python.framework.test_util) is deprecated and will be removed in a future release.
Update Note:
Use tf.config.list_physical_devices('GPU')~ instead.
2023-03-31 16:58:07.971004: I tensorflow/core/platform/cpu_feature_guard.cc:142] This tensorflow binary is optimized using the oneAPI Deep Neural Network library (oneDMN) to use the following cpus in performance critical operations Directives:
AVX-AVX2
To enable them in other ops, use appropriate compiler flags to regenerate TensorFlow
errors





Error reason



Reason for error :

This warning is usually caused by using a function or method that has been deprecated. With this warning, the is_gpu_available function is deprecated and will be removed in a future release.

Friends, follow the method below to solve it! ! !





Solution



This warning is usually caused by using a function or method that has been deprecated. In this warning, is_gpu_availablethe function is deprecated and will be removed in a future release. To fix this, you can try the following:

  1. If you don't need to use the GPU for calculations, you can ignore this warning. You can use other functions or methods in your code to check whether your TensorFlow supports GPU, for example:

    import tensorflow as tf
    print(tf.test.is_built_with_cuda())
    print(tf.test.is_gpu_available())
    

    A function is used here is_built_with_cuda()to check whether TensorFlow is compiled with CUDA support, and is_gpu_available()a function is used to check whether the GPU is available.

  2. If you need to use GPU for computing, you can try to upgrade your version of TensorFlow. In newer TensorFlow versions, is_gpu_available()functions have been replaced with tf.config.list_physical_devices('GPU')functions. You can use the following code to check if the GPU is available:

    import tensorflow as tf
    print(tf.test.is_built_with_cuda())
    print(tf.config.list_physical_devices('GPU'))
    
  3. If you have an older version of TensorFlow, you can try upgrading to a newer version to resolve this issue.

Correspondence between pytorch versions and cuda versions, official website link : https://pytorch.org/get-started/previous-versions/

Note : Does the lower version of pytorch support a higher version of cuda; a higher version of pytorch is generally compatible with a lower version of cuda. For example: you need pytorch 1.7.0, then cuda can only be 11.0 and below. The officially recommended cuda versions are 10.2 and 11.3, which support most pytorch versions.

PyTorch version CUDA environment
0.4.1、1.2.0、1.4.0、1.5.0(1)、1.6.0、1.7.0(1) 9.2
1.2.0、1.1.0、1.0.0(1) 10.0
1.4.0、1.5.0(1)、1.6.0、1.7.0(1) 10.1
1.5.0(1)、1.6.0、1.7.0(1)、1.8.0(1)、1.9.0、1.10.0 10.2
1.7.0(1) 11.0
1.8.0(1)、1.9.0、1.10.0 11.1
1.8.0(1)、1.9.0、1.10.0 11.3

The above is the solution to the cause of this error. Welcome to leave a message in the comment area to discuss whether it can be solved.If it is useful, please like and collect the article. Thank you for your support. The blogger has the motivation to keep recording the problems encountered.!!!

Thousands of full-stack VIP Q&A group to contact bloggers to help solve errors

Due to the limited time and energy of bloggers, there are too many private messages every day, and there is no way for every fan to reply in time, so reply to VIP fans first, and you can enter the thousand-person full stack by subscribing to the time-limited 9.9 paid column "100 Days Mastering Python from Getting Started to Employment" VIP answering group, get priority answering opportunities (code guidance, remote service), free prostitution 80G learning materials spree, column subscription address: https://blog.csdn.net/yuan2019035055/category_11466020.html

  • Advantages :The author gives priority to answering opportunities (code guidance, remote service), and many bigwigs in the group can hold together to keep warm (big factory internal promotion opportunities). This column is a complete set of teaching specially prepared for students with zero foundation and those who need advanced improvement , From 0 to 100, continue to advance and deepen, and there will be practical projects in the follow-up, so you can easily deal with interviews!

  • Column benefits :Resume guidance, internal referral for recruitment, weekly delivery of physical books, 80G full-stack learning videos, 300 IT e-books: Python, Java, front-end, big data, database, algorithm, crawler, data analysis, machine learning, interview question bank, etc.

  • Note : If you want to get a timely reply, communicate and learn with the big guys, after subscribing to the column, private message the blogger to enter the VIP Q&A group with thousands of peopleinsert image description here
    insert image description here

Free information acquisition, more fan benefits, follow the official account below to obtain

insert image description here

Guess you like

Origin blog.csdn.net/yuan2019035055/article/details/130047662