Check if GPU is accessible in Tensorflow



    Ken Malley

    The following code prints the CUDA and CUDNN versions that the given computer is configured to use.

    Library: tensorflow

    import tensorflow as tf
    sys_details = tf.sysconfig.get_build_info()
    cuda = sys_details["cuda_version"]
    cudnn = sys_details["cudnn_version"]
    print(cuda, cudnn)
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.