pytorch CUDNN_STATUS_MAPPING_ERROR

开发中遇到需要将tensorrt和pytorch两种语言合并起来的情况,单独运行都没问题,合并后,发现pytorch提示RuntimeError: CuDNN error: CUDNN_STATUS_MAPPING_ERROR。查看cudnn_status中该错误码表示的意思如下。

CUDNN_STATUS_MAPPING_ERROR
    An access to GPU memory space failed, which is usually caused by a failure to bind a texture.
    To correct: prior to the function call, unbind any previously bound textures.
    Otherwise, this may indicate an internal error/bug in the library.

官方论坛上RuntimeError: CUDNN_STATUS_MAPPING_ERROR给了两个思路:pytorch版本太高了和模型没有使用net.cuda()。对比自己遇到的问题感觉都不适用,再查,找到pytorch runtime error: CUDNN_STATUS_MAPPING_ERROR ,还是强调模型没有放到gpu上。   索性在pytorch模型推理前,都经过net.cuda()处理,结果问题还真解决了。

 

参考文献:

  1. cudnn_status
  2. RuntimeError: CUDNN_STATUS_MAPPING_ERROR

  3. pytorch runtime error: CUDNN_STATUS_MAPPING_ERROR 

 

你可能感兴趣的:(pytorch)