tensorflow2.0 Failed to get convolution algorithm

tensorflow2.0 Failed to get convolution algorithm. This is probably because cuDNN failed to initialize

TensorFlow 在运行时,默认会占用所有GPU 显存资源,这是非常不友好的行为,尤其是当计算机同时有多个用户或者程序在使用GPU 资源时,占用所有GPU 显存资源会使得其他程序无法运行。因此,一般推荐设置TensorFlow 的显存占用方式为增长式占用模式,即根据实际模型大小申请显存资源,代码实现如下:

gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
    try:
        # 设置GPU为增长式占用
        for gpu in gpus:
            tf.config.experimental.set_memory_growth(gpu, True)
    except RuntimeError as e:
            # 异常打印
         print(e)
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。